Created
April 17, 2016 11:21
-
-
Save adnanfajr/0f2b7216336ade2d6f4ba5864f580dc1 to your computer and use it in GitHub Desktop.
Default nginx configuration for Rails in /etc/nginx/sites-available/default with Unicorn
This file contains 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 { | |
# Path to Unicorn SOCK file, as defined previously | |
server unix:/var/www/APP_NAME/shared/sockets/unicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
#listen [::]:80 default_server ipv6only=on; | |
root /var/www/APP_NAME/public; | |
# Make site accessible from http://localhost/ | |
server_name DOMAIN www.DOMAIN; | |
try_files $uri/index.html $uri @app; | |
location @app{ | |
proxy_pass http://app; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
} | |
if ($http_x_forwarded_proto = "http") { | |
return 301 | |
https://$server_name$request_uri; | |
} | |
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