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

首頁 > 網站 > Apache > 正文

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

2024-08-27 18:23:21
字體:
來源:轉載
供稿:網友
這篇文章主要介紹了利用Apache服務器屏蔽廣告及IP段的一般方法,同時也介紹了設置僅允許訪問的IP段從而屏蔽其他一切IP的方法,需要的朋友可以參考下

屏蔽廣告

1.在hosts文件里對需要屏蔽廣告的網站加上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. 設置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,denyAllow from all<IfModule mod_rewrite.c>RewriteEngine OnRewriteCond $1 !(adimage.html)$RewriteRule ^(.*)$ /adimage.html [L]</IfModule></Directory>

這里會將所有adimage.html的頁面都轉發到?adimage.html

3.配置一下轉發到的頁面

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

4.效果圖

20151127144002209.jpg (970×481)

有些時候查看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文件才能生效。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 伊吾县| 永寿县| 福贡县| 沂南县| 南华县| 遂宁市| 西峡县| 双鸭山市| 许昌县| 鸡西市| 板桥市| 汉川市| 中超| 西充县| 宿州市| 达日县| 合肥市| 太湖县| 浮梁县| 乌兰察布市| 沂源县| 临海市| 怀来县| 阜平县| 桂平市| 乐安县| 错那县| 房产| 宣化县| 镇宁| 和林格尔县| 隆昌县| 英吉沙县| 张家港市| 丘北县| 全椒县| 团风县| 凤庆县| 温州市| 东台市| 平和县|