【问题标题】:Configuring apache/tomcat 503 page配置 apache/tomcat 503 页面
【发布时间】:2012-09-29 14:53:28
【问题描述】:

我正在为 Web 服务器运行 Apache “Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/1.0.0d mod_jk/1.2.32”,并将 Apache Tomcat/6.0.32 作为应用程序服务器。

我需要配置 apache 以在 tomcat 关闭或不可用时呈现 503 页面。我阅读了几篇文章,建议需要在 mod_jk.conf 虚拟主机上进行配置。 One of the links 建议我需要在我的虚拟主机中进行以下操作:

<Directory /udd001/app/docroot>
    Order allow,deny
    Allow from all
</Directory>

但这似乎对我不起作用。我的 404 aqnd 503 html 文件位于/udd001/app/docroot。我的虚拟主机目前有以下似乎无法正常工作。

ErrorDocument 404 /error404.html
ErrorDocument 503 /maintenance503.html

每当tomcat宕机时,我仍然会得到404页面。

【问题讨论】:

    标签: apache tomcat


    【解决方案1】:

    我是这样做的:

    首先创建一个漂亮的 503 页面并将其配置为默认的 503 页面。请记住,您使用的路径是相对于您在 apache 配置中定义的 Documentroot 的。在我的例子中,Documentroot 的定义如下:

    DocumentRoot "c:/apache/htdocs"
    

    在该文件夹中,我有一个子文件夹/tomcat-offline,其中放置了用作 503 页面的普通网页。现在我像这样配置 503 页面:

    ErrorDocument 503 /tomcat-offline/index.html
    

    因为您可能会将所有流量都转发到tomcat,我们需要将503页面排除在转发之外,否则它将无法正常工作。就我而言,我使用 mod_jk 进行所有转发:

    JkMount /* tomcat
    

    要排除我的 503 页面并让 apache 从其 Documentroot 中提供它,我像这样卸载该页面:

    JkUnMount /tomcat-offline/* tomcat
    

    重启 apache 并关闭 tomcat。您应该能够看到 503 页面。

    【讨论】:

      猜你喜欢
      • 2011-06-07
      • 1970-01-01
      • 2018-10-20
      • 2011-12-09
      • 2016-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多