VPS参考测评推荐
专注分享VPS主机优惠信息
衡天云优惠活动
华纳云最新优惠促销活动
jtti最新优惠促销活动

2022最新简单快速自定义/定制简约美观的宝塔防火墙拦截页面,附详细宝塔防火墙拦截页面代码

locvps
主机参考:VPS测评参考推荐/专注分享VPS服务器优惠信息!若您是商家可以在本站进行投稿,查看详情!此外我们还提供软文收录、PayPal代付、广告赞助等服务,查看详情!
我们发布的部分优惠活动文章可能存在时效性,购买时建议在本站搜索商家名称可查看相关文章充分了解该商家!若非中文页面可使用Edge浏览器同步翻译!PayPal代付/收录合作

宝塔防火墙可以阻止一些常见的攻击。阻塞时会提示宝塔防火墙。如果不想让攻击者知道你使用了一个宝塔,被宝塔防火墙拦截了,可以通过自定义规则定义一个新的页面作为对应的内容。默认页面效果如下图所示

2022最新简单快速自定义/定制简约美观的宝塔防火墙拦截页面,附详细宝塔防火墙拦截页面代码-主机参考

定制后的效果如下图所示

2022最新简单快速自定义/定制简约美观的宝塔防火墙拦截页面,附详细宝塔防火墙拦截页面代码-主机参考

修改教程

宝塔面板中,点击软件商店,找到已安装的防火墙,点击设置。

选择左侧选项卡中的第二项,全局配置,我们需要修改的是右侧的“响应内容”。

点击“响应内容”后,会弹出一个在线编辑的弹出层,将这里的原代码删掉,修改为主机参考下面提供的代码接口

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>请求不被许可</title>
<style type="text/css">
<!--
body {margin: 0px; padding:0px; font-family:"微软雅黑", Arial, "Trebuchet MS", Verdana, Georgia,Baskerville,Palatino,Times; font-size:16px;}
div{margin-left:auto; margin-right:auto;}
a {text-decoration: none; color: #1064A0;}
a:hover {color: #0078D2;cursor: pointer}
img { border:none; }
h1,h2,h3,h4 {
/* display:block;*/
margin:0;
font-weight:normal;
font-family: "微软雅黑", Arial, "Trebuchet MS", Helvetica, Verdana ;
}
h1{font-size:44px; color:#0188DE; padding:20px 0px 10px 0px;}
h2{color:#0188DE; font-size:16px; padding:10px 0px 40px 0px;}
#wrapper{width:100%;}
#page{width:910px; padding:20px 20px 40px 20px; margin-top:80px;}

.button{width:180px; height:28px; margin-left:0px; margin-top:10px; background:#009CFF; border-bottom:4px solid #0188DE; text-align:center;}
.button a{width:180px; height:28px; display:block; font-size:14px; color:#fff; }
.button a:hover{ background:#5BBFFF;}

a.apply-btn {
display: inline-block;
width: 200px;
height: 50px;
line-height: 50px;
background: #0188DE;
font-size: 20px;
color: #cdfff7;
text-align: center;
}
.detail-info{
padding: 10px 0;
border: 1px solid red;
height: auto;
width: 400px;
position: absolute;
left: 0;
top:21px;
background: #fff;
border-radius: 3px;
display: none;
}
.active .detail-info{
display: block;
}
.msg-item{
padding:0 20px;
line-height: 26px;
font-size: 14px;
color:#000;
}
.msg-item label{
float:left;
height: 26px;
line-height: 26px;
width:100px;
text-align: right;
}
.msg-item div{
overflow: hidden;
line-height: 26px;
word-wrap: break-word;
word-break: break-all;
}
-->
</style></head>

<body>
<script src="https://pv.sohu.com/cityjson?ie=utf-8"></script>
<div id="wrapper">
<div id="page" style="border-style:dashed; border-color:#e4e4e4; line-height:30px; no-repeat right 130px;">
<h1 style="text-align: center;">很抱歉, 您的操作被防火墙拦截!</h1>
<h2 style="text-align: center;">Sorry, Do not do it. </h2>
<p style="text-align: center;">
<font color="green">您的IP地址已被记录:</font>
<font color="red">
<script type="text/javascript">
document.write(returnCitySN["cip"] + ', 地区:' + returnCitySN["cname"]+",浏览器版本:"+getBrowserInfo());

function getBrowserInfo()
{
var agent = navigator.userAgent.toLowerCase() ;

var regStr_ie = /msie [\d.]+;/gi ;
var regStr_ff = /firefox\/[\d.]+/gi
var regStr_chrome = /chrome\/[\d.]+/gi ;
var regStr_saf = /safari\/[\d.]+/gi ;

//IE
if(agent.indexOf("msie") > 0)
{
return agent.match(regStr_ie) ;
}

//firefox
if(agent.indexOf("firefox") > 0)
{
return agent.match(regStr_ff) ;
}

//Chrome
if(agent.indexOf("chrome") > 0)
{
return agent.match(regStr_chrome) ;
}

//Safari
if(agent.indexOf("safari") > 0 agent.indexOf("chrome") < 0)
{
return agent.match(regStr_saf) ;
}

}
</script></font></p>
</div>

</div>
</body>
</html>

点击右下角的保存依次修改剩下的,刷新缓存,测试,就可以看到新的拦截页面了。

这几篇文章你可能也喜欢:

本文由主机参考刊发,转载请注明:2022最新简单快速自定义/定制简约美观的宝塔防火墙拦截页面,附详细宝塔防火墙拦截页面代码 https://zhujicankao.com/66986.html

【腾讯云】领8888元采购礼包,抢爆款云服务器 每月 9元起,个人开发者加享折上折!
打赏
转载请注明原文链接:主机参考 » 2022最新简单快速自定义/定制简约美观的宝塔防火墙拦截页面,附详细宝塔防火墙拦截页面代码
主机参考仅做资料收集,不对商家任何信息及交易做信用担保,购买前请注意风险,有交易纠纷请自行解决!请查阅:特别声明

评论 抢沙发

评论前必须登录!