Skip to content

Instantly share code, notes, and snippets.

@caquino
Created June 22, 2013 23:36
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 caquino/5843118 to your computer and use it in GitHub Desktop.
Save caquino/5843118 to your computer and use it in GitHub Desktop.
upstream staticcontent {
keepalive 128;
server backend-01:80 max_fails=5 fail_timeout=15s;
server backend-02:80 max_fails=5 fail_timeout=15s;
server backend-03:80 max_fails=5 fail_timeout=15s;
server backend-04:80 max_fails=5 fail_timeout=15s;
}
upstream dynamiccontent {
keepalive 128;
ip_hash;
server backend-01:80 max_fails=5 fail_timeout=15s;
server backend-02:80 max_fails=5 fail_timeout=15s;
server backend-03:80 max_fails=5 fail_timeout=15s;
server backend-04:80 max_fails=5 fail_timeout=15s;
}
server {
listen 80;
location ~* \.(ico|js|css|png|gif|jpe?g|swf|txt|html?|htc)$ {
expires 7d;
proxy_next_upstream error timeout invalid_header http_500 updating;
proxy_cache_valid 200 7d;
proxy_set_header Host $host;
proxy_pass http://staticcontent;
}
location / {
proxy_next_upstream error timeout invalid_header http_500 updating;
proxy_set_header Host $host;
proxy_pass http://dynamiccontent;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment