nginx从1.9.9升级到1.16.1的问题,记录下
因为老版本有如下的漏洞:
- nginx 安全漏洞(CVE-2019-9511) 漏洞
- nginx 安全漏洞(CVE-2019-9513) 漏洞
- nginx 安全漏洞(CVE-2019-9516) 漏洞
升级到1.16.1就解决了三个漏洞。简单粗暴的方式就是删除,重新安装。
删之前请先停掉nginx。
先查找所有的nginx,然后再删除掉 代码片
.
find / -name nginx*
rm -rf /路径/nginx*
然后解压下载的nginx-1.16.1.tar.gz文件,再配置ssl,最后make下代码片
.
tar -xzvf nginx文件
cd nginx
./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-pcre
make
make install
cd到sbin目录,查看版本号
./nginx -V
nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
最后在看看能不能运行
./nginx -t
nginx: [alert] could not open error log file: open() "/usr/local/app/nginx/logs/error.log" failed (2: No such file or directory)
nginx: the configuration file /usr/local/app/nginx/conf/nginx.conf syntax is ok
[emerg] 570#0: open() "/usr/local/app/nginx/logs/nginx.pid" failed (2: No such file or directory)
nginx: configuration file /usr/local/app/nginx/conf/nginx.conf test failed
如何跟我一样报这个错误,是因为nginx目录下没的logs这个文件夹,新建一个就OK了。
最后再试试。
./nginx -t
nginx: the configuration file /usr/local/app/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/app/nginx/conf/nginx.conf test is successful
成功,就./nginx启动,ps查看下
ps -ef|grep nginx
root 2578 1 0 18:59 ? 00:00:00 nginx: master process ./nginx
nobody 2579 2578 0 18:59 ? 00:00:00 nginx: worker process
root 2612 7939 0 18:59 pts/1 00:00:00 grep --color=auto nginx
大功告成!