linux启动停止php,linux环境停止和启动nginx

本文详细介绍了在Linux系统中如何优雅地停止、快速停止以及强制停止Nginx服务,以及如何启动Nginx。通过`ps`命令查找主进程号,然后使用`kill`或`pkill`配合信号量执行操作。此外,展示了不同环境下启动Nginx的命令行示例。
摘要由CSDN通过智能技术生成

步骤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教程有兴趣的朋友有所帮助。

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值