开发者

apache tomcat 503 custom error page

I have apache2 and tomcat6(not installed from apt repository, manually downloaded and installed) running on port 80 with mod_jk setup. The jsp servlet pages are accessed pointing the browser to http://myapp.mydomain.com/ (virtual hosting is done in tomcat(server.xml) and in apache). I'm trying to redirect tomcat's error page 503 to custom error page when tomcat is down(pkill -9 java or /etc/init.d/tomcat stop) during deployment.

My apache's Document Root is /var/www/ so I place below entry in apache2.conf file

ErrorDocument 503 maintenance.html and created a file maintenance.html under /var/www. When I tested stopping the tomcat and I got the pa开发者_Python百科ge redirected to maintenance.html without having the url changed but the actual page is not displayed, instead the file name maintenance.html is displayed on the browser. Could any one help me properly configuring apache that redirects to proper maintenance.html page when tomcat is down?.


From the apache documentation,

URLs can begin with a slash (/) for local web-paths (relative to the 
DocumentRoot), or be a full URL which the client can resolve.

I guess ErrorDocument 503 /maintenance.html should work.


If you're using Apache with Tomcat connectors, the solution is slightly more complicated than simply adding and ErrorDocument directive. You have to explicitly tell Apache to NOT look within the mounted connector for your /maintenance.html file; rather it needs to look locally for it instead.

I posted my working solution to this problem here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜