Apache防盜煉說明

2021-04-14 02:09:11 字數 3256 閱讀 3265

最近,大家都比較關心防盜煉的問題,擔心安裝了supesite/x-space之後,開通部落格的朋友多了

首先,找到您的apache設定檔案,

一般情況下在 /usr/local/apache/conf/httpd.conf

或者apache 2.2 的 /usr/local/apache2/conf/extra/httpd-vhost.conf

您可以酌情找到自己的conf檔案,windows和freebsd下也一樣,然後找到類似如下內容

引用:這個是帶rewrite的

documentroot /home/www

servername www.yourdomin.com

rewriteengine on

rewriterule ^/supesite/([0-9]+)/spacelist(.*)$ /supesite/index.php?$1/action_spacelist$2

rewriterule ^/supesite/([0-9]+)/viewspace_(.+)$ /supesite/index.php?$1/action_viewspace_itemid_$2

rewriterule ^/supesite/([0-9]+)/viewbbs_(.+)$ /supesite/index.php?$1/action_viewbbs_tid_$2

rewriterule ^/supesite/([0-9]+)/(.*)$ /supesite/index.php?$1/$2

rewriterule ^/supesite/([0-9]+)$ /supesite/index.php?$1

rewriterule ^/supesite/action_(.+)$ /supesite/index.php?action_$1

rewriterule ^/supesite/category_(.+)$ /supesite/index.php?action_category_catid_$1

rewriterule ^/supesite/itemlist_(.+)$ /supesite/index.php?action_itemlist_catid_$1

rewriterule ^/supesite/viewnews_(.+)$ /supesite/index.php?action_viewnews_itemid_$1

rewriterule ^/supesite/viewthread_(.+)$ /supesite/index.php?action_viewthread_tid_$1

rewriterule ^/supesite/index([/.a-za-z0-9]*)$ /supesite/index.php

引用:這個是不帶rewrite的

documentroot /home/www

servername www.yourdomin.com

在其中加入一段,具體內容如下:

引用:setenvifnocase referer "^http://www.yourdomin.com" local_ref=1

其中紅色的是您的**,如果有多個,就加多行

綠色的是您需要防盜煉的檔案字尾,中間用|隔開

還一種寫法,是用正則的,這種寫法在各個版本的apache比較通用。

寫法是引用:

其中紅色的部分有一點區別,用正則寫法,  / 符號代表轉義,因為.本身在正則中有自己的作用。

最終改完就變成了

引用:documentroot /home/www

好了,之後您重新啟動apache,至此您的盜鏈命運就結束了

使用apache防盜煉

組網結構 修改apache配置檔案httpd.conf 加入以下配置,防止外部 請求自己服務的資源 1.請求頭域裡要求帶有referer資訊.指定只有特定的 才可以訪問本服務資源.2.通過location指令指定匹配某一url生效.注意 location storageweb servlet pcd...

apache配置防盜煉

防止其他使用者引用自己服務上的檔案及,增加莫名的流量頻寬和占用伺服器資源。可以設定防盜煉放置本地伺服器的檔案或者資源被其他 引用從而占用伺服器資源。增加如下內容 空referer是指沒有經過其他網域名稱搜尋或者頁面而是直接輸入某或者檔案鏈結,直接進行訪問,該形式沒有referer。root zhou...

Apache防盜煉設定

配置位置一般情況下在 usr local apache2 conf httpd.conf 或者apache 2.2 的 usr local apache2 conf extra httpd vhost.conf 新增 setenvifnocase referer local ref setenvif...