Created
August 7, 2013 22:20
-
-
Save scudco/6179383 to your computer and use it in GitHub Desktop.
Basic configuration for nginx with rails app using unicorn
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 appname_unicorn { | |
server unix:/var/www/appname/shared/unicorn.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name www.domain-name.com; | |
rewrite ^(.*) http://domain-name.com$1 permanent; | |
} | |
server { | |
listen 80; | |
server_name domain-name.com *.domain-name.com; | |
root /var/www/appname/current/public; | |
location / { | |
try_files $uri @appname; | |
} | |
location @appname { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_pass http://appname_unicorn; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment