当前位置:首页 > 操作系统 > Linux

Linux-Nginx-关闭进程

当然就仅仅是介绍一条命令了,就这么简单。


nginx默认创建一个工作进程

                root      2713     1  0 07:56 ?        00:00:00 nginx: master process ../sbin/nginx
nobody    2714  2713  0 07:56 ?        00:00:00 nginx: worker process

            

改动worker_processes=10。来创建多个进程

                
                    #user  nobody;
worker_processes  10;

#error_log  logs/error.log;#error_log  logs/error.log  notice;#error_log  logs/error.log  info;

pid        logs/nginx.pid;

events {
    worker_connections  1024;
}
            

                fuhui@ubuntu:/usr/local/nginx$ ps -ef | grep ‘nginx‘ 
root      27131007:56 ?        00:00:00 nginx: master process ../sbin/nginx
nobody    27472713008:00 ?
            

00:00:00 nginx: worker process nobody 27482713008:00 ? 00:00:00 nginx: worker process nobody 27492713008:00 ? 00:00:00 nginx: worker process nobody 27502713008:00 ? 00:00:00 nginx: worker process nobody 27512713008:00 ?

00:00:00 nginx: worker process nobody 27522713008:00 ? 00:00:00 nginx: worker process nobody 27532713008:00 ?

00:00:00 nginx: worker process nobody 27542713008:00 ?

00:00:00 nginx: worker process nobody 27552713008:00 ?

00:00:00 nginx: worker process nobody 27562713008:00 ? 00:00:00 nginx: worker process fuhui 28522332008:29 pts/600:00:00 grep --color=auto nginx


    错误的运行方式
fuhui@ubuntu:/usr/local/nginx$ sudo ps -ef | grep ‘nginx‘ | awk ‘{kill -9 $2}‘
    
正确的运行方式
fuhui@ubuntu:/usr/local/nginx$ sudo kill ` ps -ef | grep ‘nginx‘ | awk ‘{print  $2}‘ `

To kill all Nginx Processes

    kill $(ps aux | grep ‘[n]ginx‘ | awk ‘{print $2}‘)


使用“跟$()效果是一样的

原文:http://www.cnblogs.com/gcczhongduan/p/5338935.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!