【发布时间】:2021-04-12 02:25:54
【问题描述】:
希望你能帮上忙。我有一个在 Docker 容器 (CentOS 7) 中运行的 apache Web 服务器,它充当运行 JBOSS 的应用程序服务器 (RHEL7.6) 的反向代理 - 这很好用。
我想通过在我的 httpd.conf 中添加一个 ProxyPass 部分来从应用程序服务器公开一些日志文件,就像在反向代理部分中提到的文档一样:https://httpd.apache.org/docs/2.4/urlmapping.html#page-header
我已经尝试通过将以下部分添加到我的 httpd.conf 来遵循这一点
ServerName "${web_server}"
DocumentRoot "/var/www/html"
ProxyRequests Off
RequestHeader set Host "${web_server}:80"
RequestHeader set X-Forwarded-Proto http
ProxyPass "/logs" "http://${app_server}:80/var/log/" retry=0
ProxyPassReverse "/logs" "http://${app_server}:80/var/log/"
# Caching for Proxy Settings
<IfModule mod_mem_cache.c>
CacheEnable mem /
MCacheSize 4096
MCacheMaxObjectCount 100
MCacheMinObjectSize 1
MCacheMaxObjectSize 2048
</IfModule>
AcceptFilter https none
使用此配置,我现有的应用程序服务器服务链接可以继续正常工作。但是 /logs 给了我一个 503 Service Unavailable。
这是 /etc/httpd/error.log 的输出
[Wed Jan 06 10:23:32.103107 2021] [proxy:debug] [pid 8:tid 139965551843072] proxy_util.c(2262): [client dockerip:57076] AH00944: connecting http://appserverfqdn/var/log/ to appserverfqdn:80
[Wed Jan 06 10:23:32.103115 2021] [proxy:debug] [pid 8:tid 139965551843072] proxy_util.c(2442): [client dockerip:57076] AH00947: connected /var/log/ to appserverfqdn:80
[Wed Jan 06 10:23:32.104832 2021] [proxy:error] [pid 8:tid 139965551843072] (113)No route to host: AH00957: HTTP: attempt to connect to appserverprivateip:80 (appserverfqdn) failed
[Wed Jan 06 10:23:32.104854 2021] [proxy:error] [pid 8:tid 139965551843072] AH00959: ap_proxy_connect_backend disabling worker for (appserverfqdn) for 0s
[Wed Jan 06 10:23:32.104859 2021] [proxy_http:error] [pid 8:tid 139965551843072] [client dockerip:57076] AH01114: HTTP: failed to make connection to backend: appserverfqdn
[Wed Jan 06 10:23:32.104863 2021] [proxy:debug] [pid 8:tid 139965551843072] proxy_util.c(2224): AH00943: HTTP: has released connection for (appserverfqdn)
这个错误很模糊 - 我猜这可能与 /var/log/ 目录的权限有关?
任何帮助/指导将不胜感激...昨天我为此陷入了困境。
【问题讨论】:
标签: docker apache logging proxy