nginx performance optimization under windows

Nginx is a very easy-to-use high-concurrency web server. Under linux, the concurrency and load are much stronger than apache. However, under the windows system, the usage is still relatively low. The data searched by Baidu are basically the tuning methods under linux. , many of which are difficult to use under the win system.

Reprinted from http://crx.xmspace.net/windows_nginx_tuning.html, the following is nginx.conf:

#user  nobody;
#worker_processes  1;
#worker_cpu_affinity 00000001 00000010;
worker_rlimit_nofile 10240;
#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
 
#pid        logs/nginx.pid;
 
events {
    worker_connections  10240;
}
 
 
http {
     include       mime.types;
     default_type  application/octet-stream;
    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';
    #access_log  logs/access.log  main;
     sendfile       on;
server_tokens off;
	 client_max_body_size    100m;
    #tcp_nopush     on;
    #keepalive_timeout  0;
     keepalive_timeout  65;
client_header_buffer_size 4k;
open_file_cache max=10240 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 1;
    #gzip  on;
	 gzip  on;  
     gzip_http_version 1.1;  
     gzip_vary on;  
     gzip_comp_level 6;  
     gzip_proxied any;  
     gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/x-httpd-php image/jpeg image/gif image/png;  
     gzip_buffers 16 8k;  
     gzip_disable "MSIE [1-6]\.";
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 128k;
    #server {
    #listen       80;
    #server_name  localhost;
    #charset koi8-r;
    #access_log   logs/host.access.log  main;
    #location / {
    #root         /upupw/htdocs;
    #index        index.html index.htm index.php;
	#autoindex is;
    #}
    #error_page  404               /404.html;
    #redirect server error pages to the static page /50x.html
    #error_page   500 502 503 504  /50x.html;
    #location = /50x.html {
    #root         html;
    #}
    #proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #location ~ \.php$ {
    #proxy_pass   http://127.0.0.1;
    #}
    #pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #location ~ \.php$ {
    #root           /upupw/htdocs;
    #fastcgi_pass   127.0.0.1:9000;
    #fastcgi_index  index.php;
    #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    #include        fastcgi.conf;
    #}
    #deny access to .htaccess files, if Apache's document root
    #concurs with nginx's one
    #location ~ /\.ht {
    #deny  all;
    #}
    #}
 
    #another virtual host using mix of IP-, name-, and port-based configuration
    #server {
    #listen       8000;
    #listen       somename:8080;
    #server_name  somename  alias  another.alias;
    #location / {
    #root   html;
    #index  index.html index.htm;
    #}
    #}
 
    #HTTPS server
    #server {
    #listen       443;
    #server_name  localhost;
 
    #ssl                  on;
    #ssl_certificate      cert.pem;
    #ssl_certificate_key  cert.key;
    #ssl_session_timeout  5m;
    #ssl_protocols  SSLv2 SSLv3 TLSv1;
    #ssl_ciphers  HIGH:!aNULL:!MD5;
    #ssl_prefer_server_ciphers   on;
    #location / {
    #root   html;
    #index  index.html index.htm;
    #}
    #}
 
include vhosts.conf;
 
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325698084&siteId=291194637