本文介绍了配置阿帕奇/ tomcat的503页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阿帕奇阿帕奇/ 2.2.19(Unix的)了mod_ssl / 2.2.19的OpenSSL / 1.0.0d的mod_jk / 1.2.32为Web服务器和应用服务器的Apache Tomcat / 6.0.32。

I'm running Apache "Apache/2.2.19 (Unix) mod_ssl/2.2.19 OpenSSL/1.0.0d mod_jk/1.2.32" for Web server and Apache Tomcat/6.0.32 as the application server.

我需要配置Apache来渲染页面503每当Tomcat是向下或unavailable.I已经阅读了几个这表明,在配置需要在mod_jk.conf虚拟主机上完成的文章。 一位建议,我需要在我的虚拟主机下面的链接:

I need to configure apache to render the 503 page whenever tomcat is down or unavailable.I have read a couple of articles which suggest that the configuration need to be done on the mod_jk.conf virtual host. One of the links suggested that I need to the following in my virtual host:

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

但是,这似乎并没有为我工作。我的404 aqnd 503 HTML文件都坐在 / udd001 /应用/文档根目录。而我的虚拟主机目前这似乎不正常工作下。

But this doesn't seem to work for me. My 404 aqnd 503 html files are sitting in /udd001/app/docroot. And my virtual host currently has the following which doesn't seem to work properly.

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

每当Tomcat是下来,我仍然得到404页。

Whenever tomcat is down, I'm still getting the 404 page.

推荐答案

我这样做是这样的:

首先创建一个漂亮的503页面,并配置为默认的503页面。请记住,您使用的路径是相对于你在你的Apache配置中定义的DocumentRoot的。在我的情况下DocumentRoot的定义如下:

First create a nice 503 page and configure that as the default 503 page. Remember that the path that you use is relative to the Documentroot you defined in your apache config. In my case the Documentroot is defined as follows:

DocumentRoot "c:/apache/htdocs"

在该文件夹中我有一个子文件夹 / Tomcat的离线中,我把正常的网页,将作为503页。现在我配置了503页是这样的:

In that folder I have a subfolder /tomcat-offline in which I put normal webpage that will serve as the 503 page. Now I config the 503 page like this:

ErrorDocument 503 /tomcat-offline/index.html

由于你可能转发所有的流量到Tomcat,我们需要被转发排除503页面,否则将无法正常工作。在我来说,我使用的mod_jk做所有的转发是这样的:

Because you probably forward all your traffic to tomcat we need to exclude the 503 page from being forwarded, or else it won't work. In my case I use mod_jk to do all the forwarding like this:

JkMount /* tomcat

要排除我的503页,让阿帕奇从它的DocumentRoot服务它我卸载该网页是这样的:

To exclude my 503 page and let apache serve it from its Documentroot I unmount that page like this:

JkUnMount /tomcat-offline/* tomcat

重新启动Apache和Tomcat的带来下来。你应该能够看到503页。

Restart apache and bring tomcat down. You should be able to see the 503 page.

这篇关于配置阿帕奇/ tomcat的503页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 11:47