Created
August 3, 2013 05:10
-
-
Save kikyous/6145264 to your computer and use it in GitHub Desktop.
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
gzip on; | |
#开启gzip,同时对于api请求的json格式也开启gzip | |
gzip_types application/json; | |
#每台机器都运行nginx+unicorn,本机用domain socket,方便切换 | |
upstream ruby_backend { | |
server unix:/tmp/unicorn.sock fail_timeout=0; | |
} | |
#用try_files方式和proxy执行rails动态请求 | |
server { | |
listen 80; | |
server_name chanyouji.com; | |
root /home/kikyous/buzuche-admin/public; | |
gzip_static on; # to serve pre-gzipped version | |
expires max; | |
add_header Cache-Control public; | |
# location ~ ^/(assets)/ { | |
# gzip_static on; # to serve pre-gzipped version | |
# expires max; | |
# add_header Cache-Control public; | |
# } | |
location / { | |
proxy_redirect off; | |
proxy_set_header Host $host; | |
proxy_set_header X-Forwarded-Host $host; | |
proxy_set_header X-Forwarded-Server $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_buffering on; | |
if (!-f $request_filename) { | |
proxy_pass http://ruby_backend; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment