国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 武安市| 遂昌县| 淮南市| 卓尼县| 额济纳旗| 抚宁县| 崇礼县| 东宁县| 贵定县| 克什克腾旗| 轮台县| 金溪县| 临邑县| 沂南县| 商河县| 河北区| 策勒县| 竹溪县| 营口市| 大邑县| 兴和县| 若尔盖县| 韩城市| 佛学| 博爱县| 鲁甸县| 社会| 内丘县| 涞水县| 黎平县| 辉县市| 娄底市| 株洲县| 大石桥市| 丰台区| 周口市| 镇雄县| 荥经县| 南溪县| 邛崃市| 柳州市|