apache tomcat 503 自定义错误页面 [英] apache tomcat 503 custom error page

查看:62
本文介绍了apache tomcat 503 自定义错误页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 mod_jk 设置在端口 80 上运行 apache2 和 tomcat6(不是从 apt 存储库安装,手动下载和安装).访问jsp servlet 页面,将浏览器指向http://myapp.mydomain.com/(虚拟托管在tomcat(服务器.xml) 和在 apache 中).在部署期间,当 tomcat 关闭(pkill -9 java 或/etc/init.d/tomcat stop)时,我试图将 tomcat 的错误页面 503 重定向到自定义错误页面.

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.

我的 apache 的文档根目录是/var/www/所以我把下面的条目放在 apache2.conf 文件中

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

ErrorDocument 503 maintenance.html 并在/var/www 下创建了一个文件 maintenance.html.当我测试停止 tomcat 并且我在没有更改 url 的情况下将页面重定向到 maintenance.html 但未显示实际页面,而是在浏览器上显示文件名 maintenance.html.任何人都可以帮助我正确配置 apache 以在 tomcat 关闭时重定向到正确的 maintenance.html 页面吗?.

ErrorDocument 503 maintenance.html and created a file maintenance.html under /var/www. When I tested stopping the tomcat and I got the page 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?.

推荐答案

来自 apache 文档,

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

我想 ErrorDocument 503/maintenance.html 应该可以工作.

I guess ErrorDocument 503 /maintenance.html should work.

这篇关于apache tomcat 503 自定义错误页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆