屏蔽广告
1.在hosts文件里对需要屏蔽广告的网站加上host
例如:
#屏蔽百度视屏广告: 127.0.0.1 a.baidu.com 127.0.0.1 baidutv.baidu.com 127.0.0.1 bar.baidu.com 127.0.0.1 c.baidu.com 127.0.0.1 cjhq.baidu.com 127.0.0.1 cpro.baidu.com 127.0.0.1 drmcmm.baidu.com 127.0.0.1 e.baidu.com 127.0.0.1 eiv.baidu.com 127.0.0.1 hc.baidu.com 127.0.0.1 hm.baidu.com 127.0.0.1 ma.baidu.com 127.0.0.1 nsclick.baidu.com 127.0.0.1 spcode.baidu.com 127.0.0.1 tk.baidu.com 127.0.0.1 union.baidu.com 127.0.0.1 ucstat.baidu.com 127.0.0.1 utility.baidu.com 127.0.0.1 utk.baidu.com 127.0.0.1 focusbaiduafp.allyes.com
2. 设置apache转发,这里直接用默认路径改
<Directory "E:/Apache Software Foundation/Apache2.2/htdocs"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride All # # Controls who can get stuff from this server. # Order allow,deny Allow from all <IfModule mod_rewrite.c> RewriteEngine On RewriteCond $1 !(adimage.html)$ RewriteRule ^(.*)$ /adimage.html [L] </IfModule> </Directory>
这里会将所有adimage.html的页面都转发到?adimage.html
3.配置一下转发到的页面
<html> <body> <!--<image src="/UploadFiles/2021-04-10/psb.jpg">4.效果图
有些时候查看apache日志,会发现很多莫名其面的IP来访问网站,
下面介绍一个简单的屏蔽指定IP或者IP端的方法:
定位到你的Apache安装目录下的conf文件夹,
找到httdp.conf文件,
加入如下内容:
<Directory "你的网站根目录"> Options Indexes FollowSymLinks AllowOverride None Order deny,allow Deny from 192.168.1.99 </Directory>
解释如下:
1、
<Directory "你的网站根目录">,这里“你的网站根目录”是在这个httdp.conf文件里,
使用
DocumentRoot "你的网站根目录" 语句定义的 双引号 "……" 里的值,比如说/var/www/html之类的。
2、AllowOverride None
# AllowOverride 这个属性有两个值,None和All
当 AllowOverride 的值为All时,网站根目录里面的 .htaccess文件才能生效。
至于什么是.htaccess文件,请自己Google。
3、
Order deny,allow Deny from 192.168.1.99
使用这个命令来达到屏蔽IP的作用,类似的用法还有:
# 允许所有主机访问 Order deny,allow Allow from All
# 禁止所有主机访问 Order deny,allow Deny from All
把上面的All改成指定的IP即可达到屏蔽某个IP的效果。
屏蔽IP端也一样,比如说屏蔽192.168.1.123这个IP所在的192.168.1这个IP段,只需要这样写:
# 禁止192.168.1这个IP段访问 Order deny,allow Deny from 192.168.1.123/24
另注:
当书写为:
Order deny,allow Deny from All Allow from 192.168.1.100此时是禁止除了192.168.1.100这个IP之外的所有IP访问,也就是Deny,Allow这两个命令,在最后一个命令完成时才确定允许那些IP,禁止哪些IP。
请举一反三:
Order deny,allow Allow from All Deny from 192.168.1.100
没错,这段的意思是 允许除了192.168.1.100之外的所有IP访问。
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
更新日志
- 绝区零强袭鸣徽有哪些 绝区零强袭鸣徽效果介绍
- 魔兽世界奥格瑞玛怎么去幽暗城 奥格瑞玛去幽暗城方法介绍
- 《间谍过家家日记大作战》成就攻略一览
- 完美的音乐品质-群星《红酒杯发烧酒廊情歌》2CD[WAV]
- 群星.2011《高雄国际Hi-End音响大展纪念发烧金碟》[WAV分轨]
- 康康1999-催泪[阿尔法][WAV+CUE]
- 和守望先锋太像?《星鸣特攻》开发商:我们与众不同
- 速通玩家有福了!夏季游戏速通大会正在火热进行中
- 《使命召唤》新处决动作曝光 或联动《死侍3》?
- 《陈百强出道35周年 文质翩翩》4CD[WAV+CUE][1.8GB]
- 邓丽君《思君集》3CD[WAV+CUE][1.2GB]
- 华语流行S.H.E《12CD》2001~2010[APE+CUE][3.7GB]
- 北风之望饮品怎么调配?饮品调酒配方分享
- 原画壁纸及美图第254期,无水印可自取
- 原画壁纸及美图第255期,无水印可自取