nginx_apache.conf 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. user www www;
  2. worker_processes auto;
  3. error_log /home/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. proxy_connect_timeout 300s;
  23. proxy_send_timeout 900;
  24. proxy_read_timeout 900;
  25. proxy_buffer_size 32k;
  26. proxy_buffers 4 64k;
  27. proxy_busy_buffers_size 128k;
  28. proxy_redirect off;
  29. proxy_hide_header Vary;
  30. proxy_set_header Accept-Encoding '';
  31. proxy_set_header Host $host;
  32. proxy_set_header Referer $http_referer;
  33. proxy_set_header Cookie $http_cookie;
  34. proxy_set_header X-Real-IP $remote_addr;
  35. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  36. fastcgi_connect_timeout 300;
  37. fastcgi_send_timeout 300;
  38. fastcgi_read_timeout 300;
  39. fastcgi_buffer_size 64k;
  40. fastcgi_buffers 4 64k;
  41. fastcgi_busy_buffers_size 128k;
  42. fastcgi_temp_file_write_size 128k;
  43. #Gzip Compression
  44. gzip on;
  45. gzip_buffers 16 8k;
  46. gzip_comp_level 6;
  47. gzip_http_version 1.1;
  48. gzip_min_length 256;
  49. gzip_proxied any;
  50. gzip_vary on;
  51. gzip_types
  52. text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
  53. text/javascript application/javascript application/x-javascript
  54. text/x-json application/json application/x-web-app-manifest+json
  55. text/css text/plain text/x-component
  56. font/opentype application/x-font-ttf application/vnd.ms-fontobject
  57. image/x-icon;
  58. gzip_disable "msie6";
  59. #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.
  60. open_file_cache max=1000 inactive=20s;
  61. open_file_cache_valid 30s;
  62. open_file_cache_min_uses 2;
  63. open_file_cache_errors on;
  64. ###################pureftpd AND phpmyadmin############################
  65. server {
  66. listen 80;
  67. server_name _;
  68. access_log /home/wwwlogs/access_nginx.log combined;
  69. root /home/wwwroot/default;
  70. index index.html index.php;
  71. if ( $query_string ~* ".*[\;'\<\>].*" ){
  72. return 404;
  73. }
  74. location / {
  75. try_files $uri @apache;
  76. }
  77. location @apache {
  78. internal;
  79. proxy_pass http://127.0.0.1:9090;
  80. }
  81. location ~ .*\.(php|php5)?$ {
  82. proxy_pass http://127.0.0.1:9090;
  83. }
  84. location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
  85. expires 30d;
  86. }
  87. location ~ .*\.(js|css)?$ {
  88. expires 7d;
  89. }
  90. }
  91. ##########################vhost#####################################
  92. include vhost/*.conf;
  93. }