Skip to content

Instantly share code, notes, and snippets.

@zivee
Created September 28, 2013 01:52
Show Gist options
  • Select an option

  • Save zivee/6737560 to your computer and use it in GitHub Desktop.

Select an option

Save zivee/6737560 to your computer and use it in GitHub Desktop.
使用nginx作为tornado的反向代理服务器的配置
# 放置在 http 域下
upstream tornadobackends {
server 127.0.0.1:8000 max_fails=3 fail_timeout=1s;
server 127.0.0.1:8001 max_fails=3 fail_timeout=1s;
server 127.0.0.1:8002 max_fails=3 fail_timeout=1s;
server 127.0.0.1:8003 max_fails=3 fail_timeout=1s;
}
# 放置在 server 域下
location /api/ {
proxy_read_timeout 120;
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
#proxy_set_header Accept-Encoding 'gzip';
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://tornadobackends;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment