前面提到的Linux内核的IO复用模型epoll是五种中的一种,需要了解五种模型
启用脚本
vim /usr/lib/systemd/system/nginx.service
[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network-online.target remote-fs.target nss-lookup.target
Wants=network-online.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid 更改路径
ExecStartPre=/usr/local/nginx/sbin/nginx -t 更改路径
ExecStart=/usr/local/nginx/sbin/nginx 更改路径
ExecReload=/usr/local/nginx/sbin/nginx -s reload 更改路径
ExecStop=/bin/kill -s QUIT $MAINPID 更改路径
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
nginx -s stop
systemctl start nginx
ps ax
netstat -anrlp|grep 80
systemctl status nginx
systemctl stop nginx
systemctl enable nginx
systemctl start nginx
systemctl reload nginx
下载1.21.6(在之前的链接中有)
cd /usr/local/lnmp/nginx/sbin
cp nginx nginx.old
备份
cd nginx-1.21.6/
vim auto/cc/gcc
优化
cd objs/
cp -f nginx /usr/local/lnmp/nginx/sbin
覆盖
ps ax|grep nginx
升级:
kill -USR2 旧版本进程
kill -WINCH 旧版本进程
回收worker
///
降级:
cp -f nginx.old nginx
kill -HUP 旧版本进程
kill -WINCH 新版本进程