Skip to content

Instantly share code, notes, and snippets.

@damuz91
Created August 29, 2020 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damuz91/4026567a022c83d90a39d867841ae7f9 to your computer and use it in GitHub Desktop.
Save damuz91/4026567a022c83d90a39d867841ae7f9 to your computer and use it in GitHub Desktop.
My nginx config file using puma for rails app
upstream app {
server unix:///path/to/rails/puma.sock fail_timeout=0;
}
server {
server_name 1.2.3.4 www.myrailsapp.com;
root /path/to/rails/public;
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
location / {
proxy_pass http://app;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host 'www.railsapp.com';
proxy_set_header X-Forwarded-Proto $scheme;
}
location ~ ^/(500|404|422).html {
root /path/to/rails/public;
}
error_page 500 502 503 504 /500.html;
error_page 404 /404.html;
error_page 422 /422.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