nginx.conf 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. user www www;
  2. worker_processes auto;
  3. error_log /data/wwwlogs/error_nginx.log crit;
  4. pid /var/run/nginx.pid;
  5. worker_rlimit_nofile 51200;
  6. events {
  7. use epoll;
  8. worker_connections 51200;
  9. multi_accept on;
  10. }
  11. http {
  12. include mime.types;
  13. default_type application/octet-stream;
  14. server_names_hash_bucket_size 128;
  15. client_header_buffer_size 32k;
  16. large_client_header_buffers 4 32k;
  17. client_max_body_size 1024m;
  18. client_body_buffer_size 10m;
  19. sendfile on;
  20. tcp_nopush on;
  21. keepalive_timeout 120;
  22. server_tokens off;
  23. tcp_nodelay on;
  24. fastcgi_connect_timeout 300;
  25. fastcgi_send_timeout 300;
  26. fastcgi_read_timeout 300;
  27. fastcgi_buffer_size 64k;
  28. fastcgi_buffers 4 64k;
  29. fastcgi_busy_buffers_size 128k;
  30. fastcgi_temp_file_write_size 128k;
  31. fastcgi_intercept_errors on;
  32. #Gzip Compression
  33. gzip on;
  34. gzip_buffers 16 8k;
  35. gzip_comp_level 6;
  36. gzip_http_version 1.1;
  37. gzip_min_length 256;
  38. gzip_proxied any;
  39. gzip_vary on;
  40. gzip_types
  41. text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
  42. text/javascript application/javascript application/x-javascript
  43. text/x-json application/json application/x-web-app-manifest+json
  44. text/css text/plain text/x-component
  45. font/opentype application/x-font-ttf application/vnd.ms-fontobject
  46. image/x-icon;
  47. gzip_disable "MSIE [1-6]\.(?!.*SV1)";
  48. #If you have a lot of static files to serve through Nginx then caching of the files' metadata (not the actual files' contents) can save some latency.
  49. open_file_cache max=1000 inactive=20s;
  50. open_file_cache_valid 30s;
  51. open_file_cache_min_uses 2;
  52. open_file_cache_errors on;
  53. ######################## default ############################
  54. server {
  55. listen 80;
  56. server_name _;
  57. access_log /data/wwwlogs/access_nginx.log combined;
  58. root /data/wwwroot/default;
  59. index index.html index.htm index.php;
  60. #error_page 404 /404.html;
  61. #error_page 502 /502.html;
  62. location /nginx_status {
  63. stub_status on;
  64. access_log off;
  65. allow 127.0.0.1;
  66. deny all;
  67. }
  68. location ~ [^/]\.php(/|$) {
  69. #fastcgi_pass remote_php_ip:9000;
  70. fastcgi_pass unix:/dev/shm/php-cgi.sock;
  71. fastcgi_index index.php;
  72. include fastcgi.conf;
  73. }
  74. location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
  75. expires 30d;
  76. access_log off;
  77. }
  78. location ~ .*\.(js|css)?$ {
  79. expires 7d;
  80. access_log off;
  81. }
  82. location ~ /\.ht {
  83. deny all;
  84. }
  85. }
  86. ########################## vhost #############################
  87. include vhost/*.conf;
  88. }