1. user nobody;
  2. worker_processes 4;
  3. worker_rlimit_nofile 40960;
  4. pid /var/run/nginx.pid;
  5. events {
  6. worker_connections 4096;
  7. multi_accept on;
  8. }
  9. http {
  10. server_name_in_redirect off;
  11. server_names_hash_max_size 10240;
  12. server_names_hash_bucket_size 1024;
  13. gzip on;
  14. gzip_static on;
  15. gzip_disable "MSIE [1-6]\.";
  16. gzip_vary on;
  17. gzip_proxied any;
  18. gzip_comp_level 6;
  19. gzip_buffers 16 8k;
  20. gzip_http_version 1.1;
  21. gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript image/png image/gif image/jpeg;
  22. connection_pool_size 256;
  23. client_header_buffer_size 256k;
  24. large_client_header_buffers 4 256k;
  25. client_max_body_size 200M;
  26. client_body_buffer_size 600k;
  27. request_pool_size 64k;
  28. output_buffers 4 32k;
  29. open_file_cache max=2000 inactive=20s;
  30. open_file_cache_valid 60s;
  31. include mime.types;
  32. default_type application/octet-stream;
  33. error_log logs/error.log warn;
  34. access_log off;
  35. server_tokens off;
  36. autoindex off;
  37. sendfile off;
  38. ignore_invalid_headers on;
  39. reset_timedout_connection on;
  40. # Timeouts
  41. client_header_timeout 5;
  42. client_body_timeout 50;
  43. send_timeout 50;
  44. keepalive_timeout 50;
  45. resolver_timeout 2s;
  46. #------- PROXY CACHE : NEED REMOTE ADDRESS AND COOKIE - SO THAT PUBLIC CACHES ARE SEPARATE
  47. #------- NEED TO MAKE SURE LANGUAGE IS ALSO CACHED!
  48. proxy_cache_path /dev/shm/proxy_cache levels=1:2 keys_zone=proxyone:10m inactive=10m max_size=100m;
  49. proxy_cache_key "$scheme$host$request_uri$cookie___myuser";
  50. proxy_cache proxyone;
  51. proxy_cache_min_uses 1;
  52. proxy_cache_valid any 60s;
  53. proxy_cache_valid 404 0s;
  54. proxy_cache_valid 500 502 503 504 1s;
  55. #>>>>>>>>>>>>>>>>>>>>>>>>>>>>> MYDOMAIN SERVER >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  56. server
  57. {
  58. listen 127.0.0.1:80;
  59. listen MY.IP.IS.HERE:80;
  60. server_name MYDOMAIN.com www.MYDOMAIN.com;
  61. root /home/MYDOMAIN/public_html;
  62. index index index.php index.html;
  63. error_page 403 = @backend;
  64. error_page 404 = @backend;
  65. error_page 405 = @backend;
  66. # IMPORTANT FILES
  67. location = /\.htaccess { deny all; access_log off; log_not_found off; }
  68. location ~ /\.ht { deny all; access_log off; log_not_found off; }
  69. location = /favicon.ico { log_not_found off; access_log off; expires max; }
  70. location = /robots.txt { allow all; log_not_found off; access_log off; expires max; }
  71. location = /sitemap.gz { allow all; log_not_found off; access_log off; expires max; }
  72. location = /crossdomain.xml { allow all; log_not_found off; access_log off; expires max; }
  73. location / {
  74. location ~.*\.(gif|jpg|png|ico|swf|rss|xml|htm|txt|js|css|gz|doc|xls|pdf)$ {
  75. expires max;
  76. try_files $uri @backend;
  77. log_not_found off;
  78. }
  79. proxy_pass http://MY.IP.IS.HERE:8889;
  80. include proxy.inc;
  81. }
  82. location @backend {
  83. internal;
  84. proxy_pass http://MY.IP.IS.HERE:8889;
  85. include proxy.inc;
  86. }
  87. } # End of server block
  88. } # End of http block