Skip to content

Instantly share code, notes, and snippets.

@aaronmyatt
Created May 13, 2018 15:06
Show Gist options
  • Save aaronmyatt/30f1e0166976a764acac259a8f80ccb7 to your computer and use it in GitHub Desktop.
Save aaronmyatt/30f1e0166976a764acac259a8f80ccb7 to your computer and use it in GitHub Desktop.
upstream {{APP_NAME}} {
server unix:/home/{{APP_NAME}}/app/shared/unicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name example.com;
root /home/{{APP_NAME}}/app/current/public;
location /assets/ {
gzip_static on; # serve pre-gzipped version
expires 1M;
add_header Cache-Control public;
}
location / {
try_files $uri @app;
}
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://{{APP_NAME}};
}
}
server {
listen 80;
server_name www.example.com;
return 301 http://example.com$request_uri;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment