Apache Httpserver 集成Tomcat,在Tomcat未启动时 Error 503错误页的一种配置方式

来源:互联网 发布:mac绘画录制软件 编辑:程序博客网 时间:2024/05/16 17:18


在安装httpserver2.2.x正常使用的基础上:

1、虚拟机配置:

<VirtualHost *:80>                                                              ServerAdmin admin@machengshuang.cnServerName www.machengshuang.cnServerAlias www.machengshuang.cn                               DocumentRoot "D:\Httpserver-2.2.25\htdocs\antma"</VirtualHost>

2、在htdocs\antma 目录下建两个文件 index.html  error.html 

  index.html 如下(引用了jquery):

<!DOCTYPE html><head><title>加载中...</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />    <script src="jquery-1.10.2.js"></script>  <script type="text/javascript">  $(document).ready(function(){$.ajax({type : "get",url : "http://localhost:8080/project/",  //Tomcat项目地址data : null,cache : false,beforeSend : function(){},success : function(resp) {window.location.href = 'http://localhost:8080/project';  //Tomcat项目地址},error : function() {window.location.href = './error.html';},complete : function(){}});});  </script></head><body></body></html>

error.html 如下:

<!doctype html><html><head><meta charset="UTF-8"><title>系统正在维护</title><style>* {margin:0;padding:0;}body {background:url(images/bg.png) no-repeat;background-position:top center;width:100%;height:100%;position:relative;}.time {font-size:30px;color:#000000;position:fixed;left:50%;margin-left:-160px;margin-top:380px;}</style>  <script src="jquery-1.10.2.js"></script>  <script type="text/javascript">function getIndex(){$.ajax({type : "get",
url : "http://localhost:8080/project/",  //Tomcat项目地址
data : null,cache : false,beforeSend : function(){},success : function(resp) {clearInterval(timer);
window.location.href = 'http://localhost:8080/project';  //Tomcat项目地址
},error : function() {},complete : function(){}});}var timer=setInterval(getIndex,60000); </script></head><body> <span class="time"> 预计恢复时间:20:30 </span></body></html>

进入error.html 后,会定时访问Tomcat 项目地址可用性,一旦可用,自动跳转到项目页面



阅读全文
0 0