Apache

SOS,spark!xxx網站打開奇慢,快點給看看,趕忙幫個忙解決。

因而代班超人緊急出動,SSH登陸後臺,按照俺一向的二把刀操做手法:

一、檢查內存使用狀況
free -m

二、查看當前進程狀況
top

以上兩步未看出啥異常,那就看看apache進程吧
ps -aux|grep apache

好象進程數是多了點,但也不離譜呀,懶得深究,重啓下apache得了!(自已鄙視本身一下)

無果,仍是慢,並且是一啓動就很慢,這就不對勁了!並且很奇怪,一啓動apache的進程數就達到httpd.conf中設置的上限了!

以我多年的經驗,嘿... 被人盜鏈了!找出病因,下藥就很簡單了!

編輯httpd.conf中加入防盜鏈設置:
php

Xml代碼 複製代碼
  1. < VirtualHost  *:80 >   
  2.         DirectoryIndex index.htm index.html index.php  
  3.         LogLevel debug  
  4.         HostNameLookups off  
  5.         ServerName www.xxxxx.com  
  6.         ServerAlias xxxxx.com  
  7.         DocumentRoot /var/www/html  
  8.         SetEnvIfNoCase Referer "^http://www.xxxxx.com" local_ref = 1   
  9.         SetEnvIfNoCase Referer "^http://sign51.cn" local_ref = 1   
  10.         SetEnvIfNoCase Referer ".*\.xxxxx\.com" local_ref = 1   
  11.         < FilesMatch  "\.(gif|jpg|png|css|swf)" >   
  12.                 Order Allow,Deny  
  13.                 Allow from env = local_ref   
  14.          FilesMatch >   
  15. VirtualHost >   
 
  
  DirectoryIndex index.htm index.html index.php LogLevel debug HostNameLookups off ServerName www.xxxxx.com ServerAlias xxxxx.com DocumentRoot /var/www/html SetEnvIfNoCase Referer "^http://www.xxxxx.com" local_ref=1 SetEnvIfNoCase Referer "^http://sign51.cn" local_ref=1 SetEnvIfNoCase Referer ".*\.xxxxx\.com" local_ref=1 
 
  
    Order Allow,Deny Allow from env=local_ref 
   

 


其中xxxxx.com改爲你本身的域名(喂,你當觀衆是豬呀?沒力法,真的有時候就有是豬呢!)

保存後,service httpd restart搞掂收工!

本人原創文章,歡迎轉載,轉載請註明出處! css



已有 0 人發表留言,猛擊->>這裏<<-參與討論


JavaEye推薦
相關文章
相關標籤/搜索