欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

linux环境停止和启动nginx

程序员文章站 2022-05-22 09:13:13
...
步骤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教程有兴趣的朋友有所帮助。