1、安装依赖
yum install -y bind-utils pcre pcre-devel make zlib zlib-devel gcc-c++ libtool openssl openssl-devel wget gcc gcc-c++ zip unzip tree vim telnet lrzsz net-tools yum-utils
2、下载解压
wget http://Nginx.org/download/Nginx-1.13.12.tar.gz
tar -zxvf Nginx-1.13.12.tar.gz
3、编译安装
cd Nginx-1.13.12/
./configure --prefix=/usr/local/Nginx --with-http_ssl_module
make && make install
4、配置文件模板
[root@Nginx_test conf]# more Nginx.conf
#user nobody;
worker_processes 1;
worker_rlimit_nofile 65535;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/Nginx.pid;
events {
use epoll;
worker_connections 51200;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 512;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
include dooffe/*.conf;
}
# 多域名配置目录
mkdir /usr/local/Nginx/conf/{dooffe,cert}
5、配置开机自启
vim /usr/lib/systemd/system/Nginx.service
[Unit]
Description=Nginx service
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/Nginx/sbin/Nginx
ExecReload=/usr/local/Nginx/sbin/Nginx -s reload
ExecStop=/usr/local/Nginx/sbin/Nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable Nginx
systemctl restart Nginx
systemctl status Nginx
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。