【发布时间】:2019-08-14 04:32:46
【问题描述】:
我一个网站,即。例子.com。它的 nginx 配置文件是这样的,
server{
...
location /foo{
proxy_pass http://ip_address/;
proxy_set_header Host ip_address;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
...
}
对于上面的 ip_address,我有以下烧瓶应用程序的 nginx 配置文件,
server {
listen 80;
server_name ip_address;
location = / {
include uwsgi_params;
uwsgi_pass unix:/pathtomysocket/x.sock;
}
location / {
include uwsgi_params;
uwsgi_pass unix:/pathtomysocket/x.sock;
}
}
我想在这里实现的是,当客户端访问 example.com/foo 时,它应该从烧瓶应用程序响应,但是,有一个问题,从烧瓶应用程序生成的 url 没有 foo作为前缀,因此当单击 /abc 等其他链接时,它将重定向到 example.com/abc 而不是 example.com/foo/abc。我怎样才能达到这个结果?我搜索了很多但没有运气,我想这可能与服务器名称等有关。请帮忙。谢谢!
【问题讨论】:
标签: nginx flask uwsgi proxypass