两种方法,最快的就是killall命令根据进程名字杀死。第二就是找到nginx的master进程杀死,ps aux | grep nginx查看master进程然后再杀死worker进程才行,很明显杀死的进程不是master进程,而是worker,所以很快就被master再生成新的worker了
我们看不到matser 所以我们这次用killall 进行解决
[root@web81 etc]# ss -ntlp | grep nginx
LISTEN 0 128 *:80 *:* users:(("nginx",pid=2125,fd=6),("nginx",pid=2124,fd=6),("nginx",pid=2122,fd=6))
LISTEN 0 128 [::]:80 [::]:* users:(("nginx",pid=2125,fd=7),("nginx",pid=2124,fd=7),("nginx",pid=2122,fd=7))
[root@web81 etc]# kill -9 2125
[root@web81 etc]# ss -ntlp | grep nginx
LISTEN 0 128 *:80 *:* users:(("nginx",pid=2281,fd=6),("nginx",pid=2124,fd=6),("nginx",pid=2122,fd=6))
LISTEN 0 128 [::]:80 [::]:* users:(("nginx",pid=2281,fd=7),("nginx",pid=2124,fd=7),("nginx",pid=2122,fd=7))
[root@web81 etc]# systemctl stop nginx
[root@web81 etc]# ss -ntlp | grep nginx
LISTEN 0 128 *:80 *:* users:(("nginx",pid=2281,fd=6),("nginx",pid=2124,fd=6),("nginx",pid=2122,fd=6))
LISTEN 0 128 [::]:80 [::]:* users:(("nginx",pid=2281,fd=7),("nginx",pid=2124,fd=7),("nginx",pid=2122,fd=7))
5.放大招 killall
[root@web81 etc]# killall nginx
[root@web81 etc]# ss -ntlp | grep nginx