user www; worker_processes 2; error_log /var/log/nginx.error.log notice; #pid logs/nginx.pid; events { worker_connections 1024; multi_accept on; } timer_resolution 1s; worker_priority -5; http { include mime.types; default_type application/octet-stream; root /usr/local/www; #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 /var/log/nginx.access.log combined buffer=512k flush=5m; sendfile off; aio on; output_buffers 128 256k; charset utf-8; client_body_buffer_size 128k; client_header_buffer_size 4k; client_header_timeout 30s; client_max_body_size 5m; #error_page 404 errors/404.html #error_page 500 502 503 504 50x.html #keepalive 64; keepalive_timeout 120s; limit_conn_zone $binary_remote_addr zone=addr:20m; limit_conn addr 20; open_file_cache max=1024 inactive=1h; open_file_cache_errors on; open_log_file_cache max=20 inactive=1h; server { listen 80; server_name localhost; location ~\.(png|jpg|gip|html|htm|pdf|doc|docx|xls|xlsx|ppt|djvu|js|css)$ { try_files $uri @fpm; } location / { memcached_buffer_size 256k; memcached_pass unix:/tmp/memcached.sock; memcached_connect_timeout 1s; memcached_read_timeout 1s; memcached_send_timeout 1s; set $memcached_key "$uri?$args"; error_page 404 500 502 504 = @fpm; } location @fpm { fastcgi_pass unix:/tmp/fpm.sock; fastcgi_index index.php; fastcgi_bind $remote_addr; fastcgi_buffers 8 32k; fastcgi_busy_buffers_size 128k; fastcgi_cache off; fastcgi_ignore_client_abort on; fastcgi_keep_conn on; fastcgi_max_temp_file_size 0; fastcgi_send_lowat 16k; fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; } } }