【问题标题】:Nginx reverse proxy issue with UbuntuUbuntu的Nginx反向代理问题
【发布时间】: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


    【解决方案1】:

    尝试输入 IP 地址,而不是 FQDN。您也可以尝试使用解析器 YOUR_INTERNAL_DNS_SERVER 指令。

    【讨论】:

    • 这是评论,不是答案
    猜你喜欢
    • 2020-05-20
    • 1970-01-01
    • 2014-10-27
    • 1970-01-01
    • 1970-01-01
    • 2015-08-19
    • 1970-01-01
    • 1970-01-01
    • 2019-05-17
    相关资源
    最近更新 更多