【发布时间】:2012-06-17 03:15:03
【问题描述】:
我有一个 Pyramid 应用程序在 nginx(监听端口 8080)后面的 gunicorn(监听 Unix 套接字)上运行。当 Pyramid 视图返回 HTTPFound(location='/') HTTP 响应包含 Location: http://example.host/ 而没有端口号时,用户会收到“无法连接”错误。我不知道在哪里指定非标准端口号,或者(最好)如何告诉 Pyramid 在生成 Location 标头时从请求中提取它。
摘自应用程序配置:
[server:main]
use = egg:gunicorn#main
host = unix:%(here)s/run/server.sock
workers = 4
Nginx 配置:
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;
}
}
【问题讨论】:
标签: python redirect nginx pyramid gunicorn