最佳答案
你当然可以.看看nginx.conf example on tornado’s homepage.
@H_404_21@ 原文链接:https://www.f2er.com/nginx/434647.html您的案件中的相关位将是:
http {
# Enumerate all the Tornado servers here
upstream frontends {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
server 127.0.0.1:8003;
}
...
server {
...
# for your "static" website
location ^~ /static/ {
root /var/www;
if ($query_string) {
expires max;
}
}
# for your tornado's app
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect false;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://frontends;
}
...
}
...
}