国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > Apache > 正文

利用Apache服務(wù)器屏蔽廣告及IP段的一般方法

2024-08-27 18:26:24
字體:
供稿:網(wǎng)友

屏蔽廣告

1.在hosts文件里對(duì)需要屏蔽廣告的網(wǎng)站加上host

例如:

#屏蔽百度視屏廣告:127.0.0.1 a.baidu.com127.0.0.1 baidutv.baidu.com127.0.0.1 bar.baidu.com127.0.0.1 c.baidu.com127.0.0.1 cjhq.baidu.com127.0.0.1 cpro.baidu.com127.0.0.1 drmcmm.baidu.com127.0.0.1 e.baidu.com127.0.0.1 eiv.baidu.com127.0.0.1 hc.baidu.com127.0.0.1 hm.baidu.com127.0.0.1 ma.baidu.com127.0.0.1 nsclick.baidu.com127.0.0.1 spcode.baidu.com127.0.0.1 tk.baidu.com127.0.0.1 union.baidu.com127.0.0.1 ucstat.baidu.com127.0.0.1 utility.baidu.com127.0.0.1 utk.baidu.com127.0.0.1 focusbaiduafp.allyes.com

 

2. 設(shè)置apache轉(zhuǎn)發(fā),這里直接用默認(rèn)路徑改

<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,denyAllow from all<IfModule mod_rewrite.c>RewriteEngine OnRewriteCond $1 !(adimage.html)$RewriteRule ^(.*)$ /adimage.html [L]</IfModule></Directory>

這里會(huì)將所有adimage.html的頁面都轉(zhuǎn)發(fā)到?adimage.html

3.配置一下轉(zhuǎn)發(fā)到的頁面

<html> <body> <!--<image src="/adimage/psb.jpg">--> <?php echo "我賣廣告我@#$%^&*,哦也!"; ?> </body><html>

4.效果圖

20151127144002209.jpg (970×481)

有些時(shí)候查看apache日志,會(huì)發(fā)現(xiàn)很多莫名其面的IP來訪問網(wǎng)站,
下面介紹一個(gè)簡(jiǎn)單的屏蔽指定IP或者IP端的方法:
 
 
定位到你的Apache安裝目錄下的conf文件夾,
找到httdp.conf文件,
加入如下內(nèi)容:
 

<Directory "你的網(wǎng)站根目錄"> Options Indexes FollowSymLinks AllowOverride None Order deny,allow Deny from 192.168.1.99 </Directory>

 
解釋如下:
1、
<Directory  "你的網(wǎng)站根目錄">,這里“你的網(wǎng)站根目錄”是在這個(gè)httdp.conf文件里,
使用
DocumentRoot "你的網(wǎng)站根目錄" 語句定義的 雙引號(hào) "……" 里的值,比如說/var/www/html之類的。
 

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 浑源县| 云南省| 九龙坡区| 白河县| 富阳市| 盐源县| 山西省| 古浪县| 张家港市| 墨竹工卡县| 汕尾市| 东宁县| 浦江县| 卓尼县| 萨迦县| 紫阳县| 将乐县| 长武县| 乌审旗| 平安县| 景谷| 西峡县| 新和县| 阿尔山市| 石渠县| 苏尼特左旗| 吉安县| 博爱县| 天峨县| 陕西省| 广州市| 项城市| 尚义县| 富民县| 肥西县| 贵港市| 普格县| 沐川县| 马龙县| 湖北省| 盐城市|