Skip to content

Instantly share code, notes, and snippets.

@kusakusakusa
Created September 16, 2019 21:47
Show Gist options
  • Save kusakusakusa/2d4a90e62bcd733a0612192cc53d58df to your computer and use it in GitHub Desktop.
Save kusakusakusa/2d4a90e62bcd733a0612192cc53d58df to your computer and use it in GitHub Desktop.
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