我有一个Pyramid应用程序在nginx后面(监听端口8080)运行在gunicorn上(监听Unix套接字)。当金字塔视图返回HTTPFound(location='/')时,HTTP响应包含没有端口号的Location: http://example.host/,因此用户收到“无法连接”错误。我不知道在哪里指定非标准端口号,或者(最好)如何在生成Location头时告诉Pyramid从请求中提取端口号。
摘录自应用程序配置:
[server:main]
use = egg:gunicorn#main
host = unix:%(here)s/run/server.sock
workers = 4Nginx配置:
server {
listen 8080;
root /path/to/app;
location / {
proxy_pass http://unix:/path/to/app/run/server.sock;
include proxy_params;
}
location /static {
root /path/to/app/static;
}
}https://stackoverflow.com/questions/11027156
复制相似问题