Skip to content

Instantly share code, notes, and snippets.

@yesmeck
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yesmeck/c81e5536a27800ea0d78 to your computer and use it in GitHub Desktop.
Save yesmeck/c81e5536a27800ea0d78 to your computer and use it in GitHub Desktop.
nginx
upstream app_server {
server unix:/path/to/app/tmp/sockets/unicorn.sock;
}
server {
server_name app.com;
root /path/to/app/public;
access_log /var/log/nginx/app.access.log main;
error_log /var/log/nginx/app.error.log warn;
location / {
try_files index.html $uri @app;
}
location ~ ^/(images|javascripts|stylesheets)/ {
expires 24h;
add_header Cache-Control public;
}
location ~ ^/assets/ {
access_log off;
expires 7d;
add_header Pragma public;
add_header Cache-Control "public";
}
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment