我正在8001
我的主机上运行一个带有暴露端口的 docker 容器。主机可以通过localhost:8001
. 我还在端口上运行 Apache 服务器8000
。
我的 Apache 配置如下所示(已编辑)
<VirtualHost *:8000>
ProxyPreserveHost On
DocumentRoot /var/www/html
ErrorDocument 503 /index.html
ProxyPass / http://0.0.0.0:8001/
ProxyPassReverse / http://0.0.0.0:8001/
ServerName localhost
</VirtualHost>
我想503
在 docker 容器关闭时提供自定义错误页面,但我不断收到默认错误页面。
错误日志来自/var/log/apache2/error.log
[Sat May 23 18:07:25.126481 2020] [proxy:error] [pid 8769:tid 140193025681152] (111)Connection refused: AH00957: HTTP: attempt to connect to 0.0.0.0:8001 (0.0.0.0) failed
[Sat May 23 18:07:25.126524 2020] [proxy_http:error] [pid 8769:tid 140193025681152] [client 10.135.178.51:48456] AH01114: HTTP: failed to make connection to backend: 0.0.0.0
[Sat May 23 18:07:25.126577 2020] [proxy:error] [pid 8769:tid 140193025681152] (111)Connection refused: AH00957: HTTP: attempt to connect to 0.0.0.0:8001 (0.0.0.0) failed
[Sat May 23 18:07:25.126584 2020] [proxy_http:error] [pid 8769:tid 140193025681152] [client 10.135.178.51:48456] AH01114: HTTP: failed to make connection to backend: 0.0.0.0
[Sat May 23 18:07:33.957893 2020] [proxy:error] [pid 8769:tid 140193017288448] (111)Connection refused: AH00957: HTTP: attempt to connect to 0.0.0.0:8001 (0.0.0.0) failed
[Sat May 23 18:07:33.957942 2020] [proxy_http:error] [pid 8769:tid 140193017288448] [client 10.135.64.171:65456] AH01114: HTTP: failed to make connection to backend: 0.0.0.0
[Sat May 23 18:07:33.958006 2020] [proxy:error] [pid 8769:tid 140193017288448] (111)Connection refused: AH00957: HTTP: attempt to connect to 0.0.0.0:8001 (0.0.0.0) failed
[Sat May 23 18:07:33.958013 2020] [proxy_http:error] [pid 8769:tid 140193017288448] [client 10.135.64.171:65456] AH01114: HTTP: failed to make connection to backend: 0.0.0.0
当容器运行时,代理运行良好。我究竟做错了什么?谢谢!
错误文档应该是绝对文档根目录
你不应该需要否定
ProxyPass ... !
指令。