Skip to content

Instantly share code, notes, and snippets.

@Vic-L Vic-L/nginx-rails
Created Sep 16, 2019

Embed
What would you like to do?
nginx for rails
upstream staging_backend {
server unix:///home/ubuntu/<SOMETHING>/shared/tmp/sockets/puma.sock fail_timeout=0;
}
# no server_name, routes to default this default server directive
server {
listen 80;
client_max_body_size 10m;
location / {
proxy_pass http://staging_backend;
proxy_redirect off;
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_pass_request_headers on;
}
location ~ ^/(assets|packs)/ {
root /home/ubuntu/<SOMETHING>/current/public;
expires max;
add_header Cache-Control public;
gzip_static on;
#add_header ETag "";
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.