首页 >后端开发 >php教程 >linux环境停止和启动nginx

linux环境停止和启动nginx

WBOY
WBOY原创
2016-07-29 09:14:501103浏览

步骤1:查询nginx主进程号

ps -ef | grep nginx
在进程列表里 面找master进程,它的编号就是主进程号了。

步骤2:停止nginx

从容停止Nginx:
kill -QUIT 主进程号
快速停止Nginx:
kill -TERM 主进程号
强制停止Nginx:
pkill -9 nginx

步骤3:启动nginx

环境1:
[root@iZ25yepqfvvZ /]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

[root@iZ25yepqfvvZ /]# ps -ef | grep nginx
root 18798 1 0 16:35 ? 00:00:00 nginx: master process /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
root 18799 18798 0 16:35 ? 00:00:00 nginx: worker process
root 18800 18798 0 16:35 ? 00:00:00 nginx: worker process
root 18801 18798 0 16:35 ? 00:00:00 nginx: worker process
root 18802 18798 0 16:35 ? 00:00:00 nginx: worker process
root 18827 15138 0 16:36 pts/1 00:00:00 grep nginx

环境2
[root@iZ25yepqfvvZ /]# /usr/sbin/nginx -c /etc/nginx/nginx.conf

[root@iZ25knm9r1gZ ~]# ps -ef | grep nginx
root 28969 1 0 16:50 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx 28970 28969 0 16:50 ? 00:00:00 nginx: worker process
nginx 28971 28969 0 16:50 ? 00:00:00 nginx: worker process
nginx 28972 28969 0 16:50 ? 00:00:00 nginx: worker process
nginx 28974 28969 0 16:50 ? 00:00:00 nginx: worker process
root 29419 29401 0 17:11 pts/0 00:00:00 grep nginx

以上就介绍了linux环境停止和启动nginx,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn