cat /etc/redhat-release && uname -r
CentOS Linux release 7.8.2003 (Core)
3.10.0-1127.el7.x86_64
systemctl stop firewalld && systemctl disable firewalld
echo SELINUX=disabled > /etc/sysconfig/selinux
cp -pv /etc/sysctl.conf /etc/sysctl.conf.bak
echo "net.ipv4.tcp_fin_timeout=2"? >> /etc/sysctl.conf
echo "net.ipv4.tcp_tw_reuse=1"? >> /etc/sysctl.conf
echo "net.ipv4.tcp_tw_recycle=1"? >> /etc/sysctl.conf
sysctl -p
yum install -y supervisor nginx
supervisord -c /etc/supervisord.conf &&? cp -pv /etc/supervisord.conf? /etc/supervisord.conf.bak
touch? /etc/supervisord.d/nginx.ini && cat /etc/supervisord.d/nginx.ini?
[program:nginx]
command = /usr/sbin/nginx
autostart=true
autorestart=unexpected
exitcodes=0
stdout_logfile=/var/log/nginx/error.log
supervisorctl reload? 修改配置文件从新加载
supervisorctl start/restart nginx? 管理nginx
systemctl restart? supervisord && systemctl enable supervisord
http://192.168.1.16:9001/? ?启用web页
ps -ef | grep supervisor
root? ? ? ?1503? ? ? 1? 0 21:36 ?? ? ? ? 00:00:00 /usr/bin/python /usr/bin/supervisord -c /etc/supervisord.conf
root? ? ? ?1522? ?1305? 0 21:36 pts/0? ? 00:00:00 grep --color=auto supervisor
netstat -tuplna | grep 9001
tcp? ? ? ? 0? ? ? 0 127.0.0.1:9001? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? ?LISTEN? ? ? 1503/python?
netstat -tuplna | grep nginx
tcp? ? ? ? 0? ? ? 0 0.0.0.0:80? ? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? ?LISTEN? ? ? 2758/nginx: worker??
tcp6? ? ? ?0? ? ? 0 :::80? ? ? ? ? ? ? ? ? ?:::*? ? ? ? ? ? ? ? ? ? LISTEN? ? ? 2758/nginx: worker??
kill -9 2758
netstat -tuplna | grep nginx
tcp? ? ? ? 0? ? ? 0 0.0.0.0:80? ? ? ? ? ? ? 0.0.0.0:*? ? ? ? ? ? ? ?LISTEN? ? ? 3061/nginx: master??
tcp6? ? ? ?0? ? ? 0 :::80? ? ? ? ? ? ? ? ? ?:::*? ? ? ? ? ? ? ? ? ? LISTEN? ? ? 3061/nginx: master??
原文:https://blog.51cto.com/mailfile/2872266