AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1018387
Accepted
intelis
intelis
Asked: 2020-05-24 08:05:57 +0800 CST2020-05-24 08:05:57 +0800 CST 2020-05-24 08:05:57 +0800 CST

Apache反向代理503自定义页面不起作用

  • 772

我正在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

当容器运行时,代理运行良好。我究竟做错了什么?谢谢!

ubuntu apache-2.2 docker
  • 1 1 个回答
  • 3091 Views

1 个回答

  • Voted
  1. Best Answer
    Gerald Schneider
    2020-05-24T08:55:28+08:002020-05-24T08:55:28+08:00

    错误文档应该是绝对文档根目录

    DocumentRoot /var/www/html
    ErrorDocument 503 /index.html
    

    你不应该需要否定ProxyPass ... !指令。

    • 1

相关问题

  • 在 Ubuntu 上设置电子邮件服务器

  • 在 Linux Xen VPS 上优化 Apache 和 MySQL

  • mod_rewrite 不转发 GET 参数

  • 保护新的 Ubuntu 服务器 [关闭]

  • (软)Ubuntu 7.10 上的 RAID 6,我应该迁移到 8.10 吗?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve