国产探花免费观看_亚洲丰满少妇自慰呻吟_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文件才能生效。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 丁青县| 梨树县| 金堂县| 胶州市| 乐都县| 依安县| 皮山县| 德清县| 宁南县| 永春县| 自治县| 五常市| 涡阳县| 政和县| 绥芬河市| 汝阳县| 罗田县| 阳西县| 扎鲁特旗| 兴和县| 凉城县| 淄博市| 仁寿县| 海宁市| 崇信县| 沽源县| 兰考县| 上蔡县| 焉耆| 榕江县| 凉城县| 敦化市| 原平市| 肇源县| 和田县| 汶上县| 开平市| 麦盖提县| 界首市| 财经| 确山县|