yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
官方下载地址
rz
tar -xzvf nginx-x.x.xx.tar.gz
笔者这里解压到了/usr/local/nginx/下
进入Nginx目录
cd nginx-1.19.9
使用默认配置
./configure
编译安装
make
make install
默认配置文件在解压目录/conf/nginx.conf
server { listen 443 http2 ssl; listen [::]:443 http2 ssl; server_name xxxx; ssl_certificate /data/ssl/ssl.crt; ssl_certificate_key /data/ssl/ssl.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE; ssl_prefer_server_ciphers on; location / { proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_pass http://localhost:8080; } location /QYJQueueImg/ { root /home/; autoindex on; } } server { listen 80; server_name backgroudimg; location / { proxy_pass http://localhost:9090/; } if ($host = xxxx.com) { return 301 https://$host$request_uri; } return 404; }
进入sbin目录
启动nginx
./nginx
重启nginx
./nginx -s reload
检查nginx配置文件是否正确
./nginx -t
最后successful是正确 fail是错误
查看ngnix安装目录
1.查看进程
ps -ef|grep nginx
ll /proc/端口号/exe