Skip to content

Instantly share code, notes, and snippets.

@vvo
Created November 10, 2013 17:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vvo/7400831 to your computer and use it in GitHub Desktop.
Save vvo/7400831 to your computer and use it in GitHub Desktop.
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=2g;
proxy_set_header Host $host;
proxy_cache STATIC;
proxy_cache_valid 200 1m;
proxy_cache_key "$scheme$host$request_uri";
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 20m;
client_body_buffer_size 128k;
expires 1m;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript application/json;
add_header Pragma public;
add_header Cache-Control "public";
proxy_hide_header Etag;
server {
server_name ~^www\.(.*)$ ;
return 301 $scheme://$1$request_uri ;
}
server {
listen 80 default_server;
location / {
proxy_pass http://localhost:12100;
}
location ~* \.(jpg|jpeg|png|gif|ico|css|js|eot|woff)$ {
expires 10y;
proxy_pass http://localhost:12100;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment