nginx_apache.conf 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. }
  10. http {
  11. include mime.types;
  12. default_type application/octet-stream;
  13. server_names_hash_bucket_size 128;
  14. client_header_buffer_size 32k;
  15. large_client_header_buffers 4 32k;
  16. client_max_body_size 50m;
  17. sendfile on;
  18. tcp_nopush on;
  19. keepalive_timeout 120;
  20. server_tokens off;
  21. tcp_nodelay on;
  22. fastcgi_connect_timeout 300;
  23. fastcgi_send_timeout 300;
  24. fastcgi_read_timeout 300;
  25. fastcgi_buffer_size 64k;
  26. fastcgi_buffers 4 64k;
  27. fastcgi_busy_buffers_size 128k;
  28. fastcgi_temp_file_write_size 128k;
  29. #Gzip Compression
  30. gzip on;
  31. gzip_buffers 16 8k;
  32. gzip_comp_level 6;
  33. gzip_http_version 1.1;
  34. gzip_min_length 256;
  35. gzip_proxied any;
  36. gzip_vary on;
  37. gzip_types
  38. text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
  39. text/javascript application/javascript application/x-javascript
  40. text/x-json application/json application/x-web-app-manifest+json
  41. text/css text/plain text/x-component
  42. font/opentype application/x-font-ttf application/vnd.ms-fontobject
  43. image/x-icon;
  44. gzip_disable "msie6";
  45. #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.
  46. open_file_cache max=1000 inactive=20s;
  47. open_file_cache_valid 30s;
  48. open_file_cache_min_uses 2;
  49. open_file_cache_errors on;
  50. ######################## default ############################
  51. server {
  52. listen 80;
  53. server_name _;
  54. access_log /data/wwwlogs/access_nginx.log combined;
  55. root /data/wwwroot/default;
  56. index index.html index.htm index.php;
  57. location /nginx_status {
  58. stub_status on;
  59. access_log off;
  60. allow 127.0.0.1;
  61. deny all;
  62. }
  63. location / {
  64. try_files $uri @apache;
  65. }
  66. location @apache {
  67. proxy_pass http://127.0.0.1:88;
  68. include proxy.conf;
  69. }
  70. location ~ .*\.(php|php5)?$ {
  71. proxy_pass http://127.0.0.1:88;
  72. include proxy.conf;
  73. }
  74. location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
  75. expires 30d;
  76. access_log off;
  77. }
  78. location ~ .*\.(js|css)?$ {
  79. expires 7d;
  80. access_log off;
  81. }
  82. }
  83. ########################## vhost #############################
  84. include vhost/*.conf;
  85. }