Skip to content

Instantly share code, notes, and snippets.

@tcmacdonald
Created August 20, 2015 21:16
Show Gist options
  • Save tcmacdonald/8e2211797c285fcfccf2 to your computer and use it in GitHub Desktop.
Save tcmacdonald/8e2211797c285fcfccf2 to your computer and use it in GitHub Desktop.
upstream app {
# Path to Unicorn SOCK file, as defined previously
server unix:/home/ubuntu/sites/something-com/shared/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name something.com;
root /home/ubuntu/sites/something-com/current/public;
location ~* ^/$ {
try_files /cache/index.html @app;
}
location / {
rewrite ^/team/?$ /team/overview redirect;
rewrite ^/about/?$ /about/news redirect;
rewrite ^/news/awards/?$ /about/awards redirect;
rewrite ^/news/?(.*)$ /about/news/$1 redirect;
rewrite ^/fire /portfolio/government redirect;
## Serve static files from defined root folder.
try_files /cache/$uri.html $uri $uri/index.html $uri.html @app;
}
location @app {
proxy_pass http://app;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment