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.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 项目地址可用性,一旦可用,自动跳转到项目页面



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序员老油条

您的鼓励将是我创作的大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值