【问题标题】:apache2 reverse proxy to docker container 403 forbidden?apache2反向代理到docker容器403被禁止?
【发布时间】:2020-05-07 23:43:37
【问题描述】:

我已经在 VPS 上的 Ubuntu 18.04 上设置了 apache2 - 我遇到了 SSL 证书问题,但无论如何,我已经将默认 conf 设置为反向代理到一个不安全的 docker 容器,目前正在运行一个测试节点应用程序(我最终想使用.net core。)这是conf文件中的设置:

    <VirtualHost 77.68.7.249:443>
            ServerName www.thegatehousewereham.com
            ServerAlias *.thegatehousewereham.com
            ServerAdmin webmaster@thegatehousewereham.com

            ProxyPreserveHost On
            ProxyPass / http://localhost:8000/
            ProxyPassReverse / http://localhost:8000/

            <Proxy http://localhost:8000/*>
              Order deny,allow
              Allow from all
            </Proxy>

我在浏览器中收到 403 禁止 - 我在 error.log 中看到:

[2020 年 1 月 21 日星期二 20:56:11.109712] [authz_core:error] [pid 1251:tid 140677341959936] [客户端 94.197.37.81:53133] AH01630:客户端被服务器配置拒绝:代理:http://localhost:8000/ [2020 年 1 月 21 日星期二 20:56:11.216718] [authz_core:error] [pid 1251:tid 140677493028608] [客户端 94.197.37.81:53133] AH01630:客户端被服务器配置拒绝:代理:http://localhost:8000/favicon.ico,引用者:@98765432 r

这可能是防火墙问题吗?

任何帮助表示赞赏。在这上面花了太长时间,只想继续。 谢谢, 安迪。

更新:我正在使用 apache 2.4,但我不确定该代理指令。我把它改成

            <Proxy http://localhost:8000/*>
              Require all granted
            </Proxy>

现在我看到了:

[2020 年 1 月 21 日星期二 21:57:01.084817] [proxy:warn] [pid 6618:tid 139968717412096] [client 94.197.37.81:54689] AH01144: 没有协议处理程序对 URL / (scheme 'http' )。如果您使用的是 mod_proxy 的 DSO 版本,请确保代理子模块包含在使用 LoadModule 的配置中。 [2020 年 1 月 21 日星期二 21:57:01.169791] [proxy:warn] [pid 6618:tid 139968709019392] [client 94.197.37.81:54688] AH01144: 没有协议处理程序对 URL /favicon.ico 有效(方案'http' )。如果您使用的是 mod_proxy 的 DSO 版本,请确保代理子模块包含在使用 LoadModule 的配置中。参考:https://thegatehousewereham.com/

我不确定这是一种改进,但它有所不同。

【问题讨论】:

    标签: apache docker proxy apache2 reverse


    【解决方案1】:

    好的,所以使用正确的代理方案让我有所收获——我想确保我启用了模块代理、proxy_http 和 proxy_balancer——前两个已经启用——它“说”的第三个已经启用,但这是输出:

    a2enmod 代理平衡器 考虑 proxy_balancer 的依赖代理: 模块代理已启用 考虑 proxy_balancer 的依赖别名: 模块别名已启用 考虑 proxy_balancer 的依赖 slotmem_shm: 启用模块 slotmem_shm。 启用模块 proxy_balancer。 要激活新配置,您需要运行: systemctl 重启 apache2

    现在它似乎工作正常 - 我看到应用程序正常,这一切都在 SSL 下。我们将看看它是如何从这里开始的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-16
      • 1970-01-01
      • 1970-01-01
      • 2021-11-14
      • 1970-01-01
      • 2021-05-04
      • 2016-07-07
      • 2019-01-14
      相关资源
      最近更新 更多