【发布时间】:2016-02-12 16:56:27
【问题描述】:
我正在尝试使用 Ubuntu 构建一个指向同一网络上另一台服务器的 nginx 反向代理。我不会详细说明为什么需要这样做,但它与终止覆盖 VPN 网络以及对访问 AWS 中的底层 ELB 实例的一些限制有关。为了配置反向代理,我将文件 /etc/nginx/sites-enabled/default 编辑为以下内容:
server {
listen 80;
server_name reverse-proxy.example.com;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://proxied-destination.example.com;
proxy_read_timeout 90;
}
}
现在,当我从网络内登录到单独的服务器时(我们在这里使用内部 DNS 和私有 IP),我使用 wget reverse-proxy.example.com/api/xyz 进行测试,我希望点击反向代理,然后被代理到代理-destination.example.com/api/xyz。在 wget 上,我收到 404 未找到。任何建议将不胜感激!
【问题讨论】:
标签: nginx reverse-proxy