网络技术分享
个人经验记录

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

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

1、虚拟机配置:

<VirtualHost *:80>                                                              
		ServerAdmin admin@machengshuang.cn
		ServerName www.machengshuang.cn
		ServerAlias www.machengshuang.cn

		DocumentRoot "D:Httpserver-2.2.25htdocsantma"		
</VirtualHost>

2、在htdocsantma 目录下建两个文件 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) 打赏
未经允许不得转载:老麻 » Apache Httpserver 集成Tomcat,在Tomcat未启动时 Error 503错误页的一种配置方式

评论 抢沙发

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续提供更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫

微信扫一扫

登录

找回密码

注册