nginx優化worker進程數量信息

nginx優化worker進程數量信息worker_processes

worker_processes  2;php

說明: worker進程數量主要參照cpu核數信息,要小於或等於服務器的cpu核數*2nginx

      worker_processes數量==cpu核數  web

      worker_processes數量<=cpu核數*2bash

   如何查看CPU的核數信息服務器

      grep processor /proc/cpuinfo|wc -lapp

      top命令--進入top命令後按數字1查看ide

   如何查看CPU的顆數信息優化

      grep 'physical id' /proc/cpuinfo|sort|uniq|wc -lui

 

在主配置文件nginx.conf中配置spa

[root@web01 conf]# cat /application/nginx/conf/nginx.conf
worker_processes  2;    #添加的
error_log logs/error.log;
 
#配置Nginx worker進程最大打開文件數
worker_rlimit_nofile 65535;
 
user www www;
events {
    #單個進程容許的客戶端最大鏈接數
    worker_connections  20480;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    #訪問日誌配置
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
 
 
    #虛擬主機
    include /application/nginx/conf/extra/www.conf;
    include /application/nginx/conf/extra/blog.conf;
    include /application/nginx/conf/extra/bbs.conf;
    include /application/nginx/conf/extra/edu.conf;
    include /application/nginx/conf/extra/phpmyadmin.conf;
    include /application/nginx/conf/extra/status.conf;
 
    #隱藏版本號
    server_tokens on;
}
相關文章
相關標籤/搜索