Python 如何在nginx上部署龙卷风页面?
我正在学习龙卷风并尝试在nginx上部署页面 我打开nginx.conf,然后添加以下内容Python 如何在nginx上部署龙卷风页面?,python,nginx,tornado,Python,Nginx,Tornado,我正在学习龙卷风并尝试在nginx上部署页面 我打开nginx.conf,然后添加以下内容 server{ listen 80; server_name _; location / { root /home/ubuntu/tornado; index index.html;
server{
listen 80;
server_name _;
location / {
root /home/ubuntu/tornado;
index index.html;
}
}
然后我可以看到那一页
但是,html上的tornado/python代码无法执行。。。它只显示在页面上,如下所示
{% from util import Utility %} {% for info in infos %}
{% end %}
{{ Utility.DecodeCharacter(info[1]) }}
{{ Utility.DecodeCharacter(info[2]) }}
有什么我还没做的吗?谢谢你的帮助 您应该将Nginx服务器配置为充当服务器。
下面是一个简单的示例,它将提供来自Nginx的静态文件,并充当您的tornado应用程序的代理
http {
# Enumerate all the Tornado servers here
upstream frontends {
server 127.0.0.1:8000;
}
# ...
server {
listen 80;
# ...
location ^~ /static/ {
# Path of your static files
root /var/www;
}
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://frontends;
}
}
}
请注意,您的Tornado应用程序应该在端口8000上运行(除了nginx服务)