公司服务器被检测出有重大漏洞
nginx拒绝服务漏洞(CNVD-2018-22805)
仔细看其实就是1.15.6之前版本和1.14.1版本不能用
那么换个版本应该就没问题了
我这里选择了1.16
整理了一下安装过程
不是专业运维所以有些操作可能会很粗暴
如果之前使用apt安装了nginx那就先干掉
sudo apt-get remove nginx nginx-common
sudo apt-get purge nginx nginx-common
sudo apt-get autoremove//这条命令网上争议很大,传说很不安全,看了半天没看懂,但是我头铁用了没问题,有大神知道的话麻烦讲解一下
sudo apt-get remove nginx-full nginx-common
下载tar包以后
tar -zxvf nginx-1.16.1.tar.gz
cd nginx-1.6.1
其中 编译前
./configure --prefix=/usr/local/nginx
应为
./configure --prefix=/usr/local/nginx --with-http_ssl_module
否则会有
https protocol requires SSL support in XXXXXX
这个错误
然后添加服务
sudo vim /lib/systemd/system/nginx.service
[Unit]
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
[Install]
WantedBy=multi-user.target
// 开启 nginx 服务
sudo systemctl start nginx.service
// 查看状态
sudo systemctl status nginx.service
// 重启服务
sudo systemctl restart nginx.service
#重启Nginx
/usr/local/nginx# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
显示nginx的版本号
sudo /usr/local/nginx/sbin/nginx -V
显示nginx的配置文件
sudo /usr/local/nginx/sbin/nginx -t
参考链接:
ubuntu16.04源码编译安装nginx1.16.2_寰宇001的博客-CSDN博客_ubuntu编译安装nginx