如何自定义一个美观的宝塔防火墙拦截页面及页面代码分享

2022-02-12 0 467

宝塔防火墙能拦截一些常规的攻击,在拦截时候会提示宝塔防火墙,如果你不想让攻击者知道你用的是宝塔并且是被宝塔防火墙拦截,可以通过自定义规则的方式定义一个新的页面作为相应内容,默认页面效果如下:

如何自定义一个美观的宝塔防火墙拦截页面及页面代码分享

通过自定义后的效果如下:

如何自定义一个美观的宝塔防火墙拦截页面及页面代码分享

修改教程

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

左侧选项卡选择第二项,全局配置,我们需要修改的就是右侧这几个「响应内容」。

如何自定义一个美观的宝塔防火墙拦截页面及页面代码分享

点击「响应内容」后,弹出一个在线编辑的弹出层,在这里删除原有代码,修改成下方我提供的代码:

<!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>

 

:本文采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可, 转载请附上原文出处链接。
1、本站提供的源码不保证资源的完整性以及安全性,不附带任何技术服务!
2、本站提供的模板、软件工具等其他资源,均不包含技术服务,请大家谅解!
3、本站提供的资源仅供下载者参考学习,请勿用于任何商业用途,请24小时内删除!
4、如需商用,请购买正版,由于未及时购买正版发生的侵权行为,与本站无关。
5、本站部分资源存放于百度网盘或其他网盘中,请提前注册好百度网盘账号,下载安装百度网盘客户端或其他网盘客户端进行下载;
6、本站部分资源文件是经压缩后的,请下载后安装解压软件,推荐使用WinRAR和7-Zip解压软件。
7、如果本站提供的资源侵犯到了您的权益,请邮件联系: 442469558@qq.com 进行处理!

猪小侠源码-最新源码下载平台 网站运营 如何自定义一个美观的宝塔防火墙拦截页面及页面代码分享 https://www.20zxx.cn/360045/zdyk/yunying.html

猪小侠源码,优质资源分享网

常见问题
  • 本站所有资源版权均属于原作者所有,均只能用于参考学习,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担
查看详情
  • 最常见的情况是下载不完整: 可对比下载完压缩包的与网盘上的容量,建议提前注册好百度网盘账号,使用百度网盘客户端下载
查看详情

相关文章

官方客服团队

为您解决烦忧 - 24小时在线 专业服务