作为代理服务器运行时的 Apache 服务器状态

f-z*_*z-N 4 proxy apache-1.3

我们运行 apache 作为代理服务器,并且在 apache 后面有 tomcat。我们正在使用 server_status 模块,但是当我们尝试访问 server_status 时,https://host.com/server-status它会重定向到 tomcat,并收到 404 错误。我对此很陌生,尝试浏览 apache 文档但无法找出解决方案。仅供参考。我们已启用 ssl

当前 ssl.conf 设置:

  ProxyRequests     Off
  ProxyPreserveHost On

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

  ProxyPass         /  http://localhost:8081/
  ProxyPassReverse  /  http://localhost:8081/
  ProxyPassReverse   /  http://myhost:8081/


    <Location /server-status>
            SetHandler server-status
            Order deny,allow
            Deny from all
            Allow from 10.90
    </Location>
Run Code Online (Sandbox Code Playgroud)

建议更改后

 ProxyRequests     Off
 ProxyPreserveHost On

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

ProxyPass         /server-status !
ProxyPass         /  http://localhost:8081/
ProxyPassReverse  /  http://localhost:8081/
ProxyPassReverse   /  http://myhost:8081/
Run Code Online (Sandbox Code Playgroud)

编辑2:

需要更改 httpd.conf,我 ProxyPass /server-status !在代理模块配置指令下添加了 ,它可以工作。

KM.*_*KM. 5

您可以!在 ProxyPass 指令中使用代理异常。就像是

ProxyPass /server-status !
Run Code Online (Sandbox Code Playgroud)

应该这样做。

有关 ProxyPass 指令的更多信息,请参阅 apache 文档:http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass,尤其是

这 !指令在您不想反向代理子目录的情况下很有用,例如