Tomcat启动不了时Apache自动跳转指定页面
2010-02-04 16:27
375 查看
首先我们的系统是Apache+Tomcat搭建的
1. Tomcat启动不了或者当机时,访问任何网站页面都返回503错误页面。由于这个页面比较简陋,无法给用户提供必要的信息以获取更多线索,无疑这会造成用户的流失。
2. 我们使用自定义503错误的方式以提供用户友好体验,避免用户流失。
我们要处理的逻辑就是:把503错误跳转到一个页面,我们取名叫:missing503.html
然后再这个页面中实现我们需要的功能。
首先定义跳转:在apache配置文件的虚拟站点定义中使用如下语句即可。
ErrorDocument 503 /help_static/missing503.html (建议使用相对路径,下面的定义表示missing503.html文件存放在DocumentRoot下的help_static目录中)
定义完成后的虚拟站点如下 (红色代表新加内容)
<VirtualHost *:443>
# General setup for the virtual host
DocumentRoot "/opt/app/mydomain_1.1_static"
ServerName www.mydomain.com
ServerAdmin postmaster@mydomain.com
ErrorLog "/var/log/httpd/error_log"
TransferLog "/var/log/httpd/access_log"
ErrorDocument 503 /help_static/missing503.html
......
</VirtualHost>
......
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html #
ErrorDocument 503 /help_static/missing503.html
3. 关于SEO
这里提供一个检查HTTP状态码网站
http://www.seoconsultants.com/tools/headers.asp#status-codes
通过这个网站的检测,自定义503错误页面,返回的是“503”错误代码,而不是“200”或“302”。因此理论上不会对SEO造成影响。
1. Tomcat启动不了或者当机时,访问任何网站页面都返回503错误页面。由于这个页面比较简陋,无法给用户提供必要的信息以获取更多线索,无疑这会造成用户的流失。
2. 我们使用自定义503错误的方式以提供用户友好体验,避免用户流失。
我们要处理的逻辑就是:把503错误跳转到一个页面,我们取名叫:missing503.html
然后再这个页面中实现我们需要的功能。
首先定义跳转:在apache配置文件的虚拟站点定义中使用如下语句即可。
ErrorDocument 503 /help_static/missing503.html (建议使用相对路径,下面的定义表示missing503.html文件存放在DocumentRoot下的help_static目录中)
定义完成后的虚拟站点如下 (红色代表新加内容)
<VirtualHost *:443>
# General setup for the virtual host
DocumentRoot "/opt/app/mydomain_1.1_static"
ServerName www.mydomain.com
ServerAdmin postmaster@mydomain.com
ErrorLog "/var/log/httpd/error_log"
TransferLog "/var/log/httpd/access_log"
ErrorDocument 503 /help_static/missing503.html
......
</VirtualHost>
......
#ErrorDocument 404 "/cgi-bin/missing_handler.pl"
#ErrorDocument 402 http://www.example.com/subscription_info.html #
ErrorDocument 503 /help_static/missing503.html
3. 关于SEO
这里提供一个检查HTTP状态码网站
http://www.seoconsultants.com/tools/headers.asp#status-codes
通过这个网站的检测,自定义503错误页面,返回的是“503”错误代码,而不是“200”或“302”。因此理论上不会对SEO造成影响。
相关文章推荐
- 在myeclipse中启动tomcat的时候会自动跳转到DualStackPlainSocketImpl的debug页面
- 执行成功倒计时以及自动跳转到指定页面
- 指定时间,页面自动跳转
- html <meta>设置自动刷新或者几秒内跳转到指定页面
- 网页启动App&网页跳转到App指定的页面
- tomcat常见错误跳转到指定页面
- Tomcat跳过默认页面跳转到指定页面
- Apache 多种方法设置HTTP页面自动跳转到HTTPS
- 在WebBrowser控件中实现自动登录并跳转到指定页面
- 一种基于自定义代码的asp.net网站首页根据IP自动跳转指定页面的方法!
- 在Eclipse中启动tomcat,都会自动跳转到debug界面的解决方法
- html <meta>设置自动刷新或者几秒内跳转到指定页面
- 一种基于自定义代码的asp.net网站首页根据IP自动跳转指定页面的方法!
- asp.net倒计时自动跳转指定页面
- tomcat的404报错页面指定即跳转方式的实现
- Eclipse中启动tomcat,都会自动跳转到debug界面解决方法
- 60秒倒计时,自动跳转到指定页面
- 启动tomcat卡在starting状态,然后访问页面就报错:org.apache.jasper.JasperException: Unable to compile class for JSP
- ecmall前台登陆注册后实现自动跳转到指定页面
- tomcat的404报错页面指定即跳转方式的实现