【发布时间】:2017-08-25 11:20:33
【问题描述】:
我试图弄清楚如何在 NGINX 中通过 proxy_pass 传递外部请求。特别是我想从http://example.com/documentation/加载Sphinx Documentation source,但实际上在重新启动NGINX服务器后我得到了502 Bad Gateway,可能是由于配置不正确。
这是我的示例配置:
server {
listen 80;
server_name example.com;
root /var/www;
location /documentation {
proxy_pass http://example.com:8000;
index index.php index.html index.htm;
}
}
在我看来它应该可以工作,有什么建议吗?
考虑一下,如果我尝试在没有 NGINX 配置的情况下通过 ssh 控制台启动 Sphinx 源,它可以工作,但源路径是这样的:http://example.com:8000,不是显示它的最佳方式。
还因为我每次都需要通过控制台命令加载它:
sphinx-autobuild 源码构建/html --host http://example.com --port8000
我没有发现任何关于在主机的特定子文件夹中启动它的信息,例如子文件夹 /documentation。
[更新]
我尝试按照@Johnny Logan 的建议将example.com 替换为localhost 指令,我在地址栏中收到了带有这种奇怪结果请求的502 Bad Request:
http://example.com/documentation:8000:8000:8000:8000:8000:8000:8000:8000:8000:8000:8000:8000:8000:8000:8000:8000:8000:8000:8000:8000/
【问题讨论】:
标签: nginx python-sphinx nginx-location proxypass