配置nginx worker 进程数


一般修改为cpu的核数的个数那么多


 cd /application/nginx/conf

 grep worker_processes nginx.conf

 sed -i 's/worker_processes  1/worker_processes  10/g' nginx.conf

 grep worker_processes nginx.conf

 /application/nginx/sbin/nginx -s reload

 ps -ef |grep nginx

##################################


[root@LNMP ~]# cd /application/nginx/conf

[root@LNMP conf]#  grep worker_processes nginx.conf

worker_processes  1;

[root@LNMP conf]# sed -i 's/worker_processes  1/worker_processes  10/g' nginx.conf

[root@LNMP conf]#  grep worker_processes nginx.conf                               

worker_processes  10;

[root@LNMP conf]# /application/nginx/sbin/nginx -s reload

[root@LNMP conf]# ps -ef |grep nginx         

nginx     1529  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1530  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1531  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1532  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1533  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1534  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

nginx     1535  1519  0 09:06 ?        00:00:00 php-fpm: pool www            

root      8467     1  0 09:45 ?        00:00:00 nginx: master process /application/nginx-1.6.2/sbin/nginx

nginx     8733  8467  0 11:44 ?        00:00:00 nginx: worker process              

nginx     8734  8467  0 11:44 ?        00:00:00 nginx: worker process              

nginx     8735  8467  0 11:44 ?        00:00:00 nginx: worker process              

nginx     8736  8467  0 11:44 ?        00:00:00 nginx: worker process              

nginx     8737  8467  0 11:44 ?        00:00:00 nginx: worker process              

nginx     8738  8467  0 11:44 ?        00:00:00 nginx: worker process              

nginx     8739  8467  0 11:44 ?        00:00:00 nginx: worker process              

nginx     8740  8467  0 11:44 ?        00:00:00 nginx: worker process              

nginx     8741  8467  0 11:44 ?        00:00:00 nginx: worker process              

nginx     8742  8467  0 11:44 ?        00:00:00 nginx: worker process              

root      8744  8626  0 11:44 pts/1    00:00:00 grep nginx

[root@LNMP conf]# 



查看cpu方法(虚拟机无法查看)

grep ‘physical id’ /proc/cpuinfo


[root@client1 /]# grep 'physical id' /proc/cpuinfo 

physical id     : 1

physical id     : 0

physical id     : 1

physical id     : 0

physical id     : 1

physical id     : 0

physical id     : 1

physical id     : 0

physical id     : 1

physical id     : 0

physical id     : 1

physical id     : 0

physical id     : 1

physical id     : 0

physical id     : 1

physical id     : 0

或者按top

先按top

之后再1

这样可以展示cpu