user nobody; worker_processes 4; worker_rlimit_nofile 40960; pid /var/run/nginx.pid; events { worker_connections 4096; multi_accept on; } http { server_name_in_redirect off; server_names_hash_max_size 10240; server_names_hash_bucket_size 1024; gzip on; gzip_static on; gzip_disable "MSIE [1-6]\."; gzip_vary on; gzip_proxied any; gzip_comp_level 6; gzip_buffers 16 8k; gzip_http_version 1.1; 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; connection_pool_size 256; client_header_buffer_size 256k; large_client_header_buffers 4 256k; client_max_body_size 200M; client_body_buffer_size 600k; request_pool_size 64k; output_buffers 4 32k; open_file_cache max=2000 inactive=20s; open_file_cache_valid 60s; include mime.types; default_type application/octet-stream; error_log logs/error.log warn; access_log off; server_tokens off; autoindex off; sendfile off; ignore_invalid_headers on; reset_timedout_connection on; # Timeouts client_header_timeout 5; client_body_timeout 50; send_timeout 50; keepalive_timeout 50; resolver_timeout 2s; #------- PROXY CACHE : NEED REMOTE ADDRESS AND COOKIE - SO THAT PUBLIC CACHES ARE SEPARATE #------- NEED TO MAKE SURE LANGUAGE IS ALSO CACHED! proxy_cache_path /dev/shm/proxy_cache levels=1:2 keys_zone=proxyone:10m inactive=10m max_size=100m; proxy_cache_key "$scheme$host$request_uri$cookie___myuser"; proxy_cache proxyone; proxy_cache_min_uses 1; proxy_cache_valid any 60s; proxy_cache_valid 404 0s; proxy_cache_valid 500 502 503 504 1s; #>>>>>>>>>>>>>>>>>>>>>>>>>>>>> MYDOMAIN SERVER >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> server { listen 127.0.0.1:80; listen MY.IP.IS.HERE:80; server_name MYDOMAIN.com www.MYDOMAIN.com; root /home/MYDOMAIN/public_html; index index index.php index.html; error_page 403 = @backend; error_page 404 = @backend; error_page 405 = @backend; # IMPORTANT FILES location = /\.htaccess { deny all; access_log off; log_not_found off; } location ~ /\.ht { deny all; access_log off; log_not_found off; } location = /favicon.ico { log_not_found off; access_log off; expires max; } location = /robots.txt { allow all; log_not_found off; access_log off; expires max; } location = /sitemap.gz { allow all; log_not_found off; access_log off; expires max; } location = /crossdomain.xml { allow all; log_not_found off; access_log off; expires max; } location / { location ~.*\.(gif|jpg|png|ico|swf|rss|xml|htm|txt|js|css|gz|doc|xls|pdf)$ { expires max; try_files $uri @backend; log_not_found off; } proxy_pass http://MY.IP.IS.HERE:8889; include proxy.inc; } location @backend { internal; proxy_pass http://MY.IP.IS.HERE:8889; include proxy.inc; } } # End of server block } # End of http block