nginx优化

user www;

pid /var/run/nginx.pid;

worker_processes 8;

worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;

worker_rlimit_nofile 65536;

#user  nobody;

#worker_processes  1;


#error_log  logs/error.log;

#error_log  logs/error.log  notice;

#error_log  logs/error.log  info;


#pid        logs/nginx.pid;



events {

 worker_connections 2048;

 multi_accept on;

 use epoll;

}



http {

    server_tokens off;

    sendfile on;

    tcp_nopush on;

    tcp_nodelay on;

    access_log off;

    error_log /data/log/nginx/error.log crit;

    keepalive_timeout 10;

    client_header_buffer_size 4k;

    client_header_timeout 10;

    client_body_timeout 10;

    client_max_body_size 1024m;

    reset_timedout_connection on;

    send_timeout 10;

    limit_conn_zone $binary_remote_addr zone=addr:5m;

    limit_conn addr 100;

    include /usr/local/nginx/conf/mime.types;

    default_type text/html;

    charset UTF-8;

    gzip on;

    gzip_disable "msie6";

    gzip_proxied any;

    gzip_min_length 1000;

    gzip_comp_level 6;

    #gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    open_file_cache max=65536 inactive=1s;

    open_file_cache_valid 1s;

    open_file_cache_min_uses 1;

    open_file_cache_errors on;


   #fastcgi_cache_path /var/logs/nginx/fastcgi_cache_dir levels=1:2 keys_zone=cache_fastcgi:128m inactive=1d max_size=10g;

    fastcgi_connect_timeout 300;

    fastcgi_send_timeout 300;

    fastcgi_read_timeout 300;

    fastcgi_buffer_size 4k;

    fastcgi_buffers 8 4k;

    fastcgi_busy_buffers_size 8k;

    fastcgi_temp_file_write_size 8k;

   # fastcgi_cache cache_fastcgi;

   # fastcgi_cache_valid 200 302 1h;

   # fastcgi_cache_valid 301 1d;

   # fastcgi_cache_valid any 1m;

   # fastcgi_cache_min_uses 1;

   # fastcgi_cache_use_stale error timeout invalid_header http_500;

   include /usr/local/nginx/conf/vhosts.conf;

   #} 

      }


你可能感兴趣的:(nginx)