Skip to content

Instantly share code, notes, and snippets.

@sanchojaf
Last active August 29, 2015 14:17
Show Gist options
  • Save sanchojaf/2b87be1df00a1e25bcb1 to your computer and use it in GitHub Desktop.
Save sanchojaf/2b87be1df00a1e25bcb1 to your computer and use it in GitHub Desktop.
/etc/nginx/sites-enabled/default
upstream app_1 {
# Path to Unicorn SOCK file, as defined previously
server unix:/home/deploy/app_1/shared/sockets/unicorn.app_1.sock fail_timeout=0;
}
server {
# Application root, as defined previously
root /home/deploy/app_1/public;
server_name www.app_1.com app_1.com;
try_files $uri/index.html $uri @app_1;
access_log /var/log/nginx/app_1_access.log combined;
error_log /var/log/nginx/app_1_error.log;
location @app_1 {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_1;
proxy_set_header X-Forwarded-Proto https; # <-- don't need this if you're not running SSL
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
upstream app_2 {
# Path to Unicorn SOCK file, as defined previously
server unix:/home/deploy/app_2/shared/sockets/unicorn.app_2.sock fail_timeo
ut=0;
}
server {
# Application root, as defined previously
root /home/deploy/app_2/public;
server_name www.app_2.com app_2.com;
try_files $uri/index.html $uri @app_2;
access_log /var/log/nginx/app_2_access.log combined;
error_log /var/log/nginx/app_2_error.log;
location @app_2 {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_2;
proxy_set_header X-Forwarded-Proto https; # <-- don't need this if you're not running SSL
}
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