Created
August 29, 2020 00:25
-
-
Save damuz91/4026567a022c83d90a39d867841ae7f9 to your computer and use it in GitHub Desktop.
My nginx config file using puma for rails app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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