Created
May 23, 2013 23:34
-
-
Save tanihiro/5640300 to your computer and use it in GitHub Desktop.
NginxでRailsの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 application-unicorn { | |
# Unicornのソケットを指定: | |
server unix:/tmp/unicorn_{application}.sock fail_timeout=0; | |
} | |
server { | |
listen 80; | |
server_name HOSTNAME; | |
client_max_body_size 4G; | |
keepalive_timeout 5; | |
# Rails static pages | |
location ~ ^/(assets|images|javascripts|stylesheets|swfs|system|favicon) { | |
root /var/www/sites/HOSTNAME/public; | |
gzip_static on; | |
expires max; | |
add_header Cache-Control public; | |
} | |
location / { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
# 振り分け先のアプリケーションを指定 | |
proxy_pass http://application-unicorn; | |
} | |
# Rails error pages | |
error_page 500 502 503 504 /500.html; | |
location = /500.html { | |
root /var/www/tagrid/current/public; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment