Forked from rkjha/nginx-config-rails4-with-puma-ssl-version.conf
Created
December 2, 2016 10:48
-
-
Save killinit/a8f991d3ae1b49610578572e55a8575a to your computer and use it in GitHub Desktop.
Nginx config for rails 4 application using puma [ssl and non-ssl version]
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 myapp_puma { | |
| server unix:/tmp/myapp_puma.sock fail_timeout=0; | |
| } | |
| # for redirecting to non-www version of the site | |
| server { | |
| listen 80; | |
| server_name www.example.com; | |
| rewrite ^(.*) http://example.com$1 permanent; | |
| } | |
| server { | |
| listen 80 default; | |
| server_name example.com; | |
| root /home/username/example.com/current/public; | |
| location ^~ /assets/ { | |
| gzip_static on; | |
| expires max; | |
| add_header Cache-Control public; | |
| } | |
| try_files $uri/index.html $uri @myapp_puma; | |
| location @myapp_puma { | |
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
| proxy_set_header Host $host; | |
| proxy_set_header X-Forwarded-Proto http; | |
| proxy_redirect off; | |
| proxy_pass http://myapp_puma; | |
| } | |
| error_page 500 502 503 504 /500.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