Skip to content

Instantly share code, notes, and snippets.

@john45
Created January 15, 2018 15:12
Show Gist options
  • Save john45/2f8f775118a4192418de14693410f35c to your computer and use it in GitHub Desktop.
Save john45/2f8f775118a4192418de14693410f35c to your computer and use it in GitHub Desktop.
nginx config for two upstrim
upstream app_1 { server unix:/home/deployer/apps/first_app/tmp/sockets/puma.sock fail_timeout=0; }
upstream app_2 { server unix:/home/deployer/apps/second_app/tmp/sockets/puma.sock fail_timeout=0; }
server {
listen 80;
server_name some.domen.ru;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
ssl on;
ssl_certificate /etc/letsencrypt/live/some.domen.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/some.domen.ru/privkey.pem;
server_name some.domen.ru;
access_log /home/deployer/apps/first_app/log/nginx.access.log;
error_log /home/deployer/apps/first_app/log/nginx.error.log;
location /location1 {
try_files $uri @puma;
}
location @puma {
include proxy_params;
proxy_pass http://app_1;
}
location /location2 {
try_files $uri @puma_1;
}
location @puma_1 {
include proxy_params;
proxy_pass http://app_2;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment