Skip to content

Instantly share code, notes, and snippets.

@boutell
Last active September 16, 2016 13:44
Show Gist options
  • Save boutell/01cc0cf292305ae7c03a2335a5eeea08 to your computer and use it in GitHub Desktop.
Save boutell/01cc0cf292305ae7c03a2335a5eeea08 to your computer and use it in GitHub Desktop.
upstream upstream-mysite {
server localhost:3000;server localhost:3001;
}
server {
listen *:80;
server_name mysite.com;
client_max_body_size 32M;
access_log /var/log/nginx/mysite.access.log;
error_log /var/log/nginx/mysite.error.log;
location @proxy-mysite-80 {
proxy_pass http://upstream-mysite;
proxy_next_upstream error timeout invalid_header http_500 http_502
http_503 http_504;
proxy_redirect off;
proxy_buffering on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
gzip_proxied any;
include "/etc/nginx/mechanic-overrides/mysite/proxy";
}
location / {
gzip on;
gzip_types text/html text/css text/javascript image/svg+xml application/vnd.ms-fontobject application/x-font-ttf application/x-javascript application/javascript;root /opt/stagecoach/apps/mysite/current/public;
try_files $uri @proxy-mysite-80;
expires 7d;
include "/etc/nginx/mechanic-overrides/mysite/location";
}
}
server {
listen *:80;
server_name _mysite_80 oldname.net www.mysite.com;
# canonicalize
location / {
rewrite ^(.*)$ http://mysite.com$1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment