SOS,spark!xxx網(wǎng)站打開奇慢,快點給看看,趕緊幫個忙解決。
于是代班超人緊急出動,SSH登錄后臺,按照俺一貫的二把刀操作手法:
1、檢查內(nèi)存使用情況
free -m
2、查看當(dāng)前進程情況
top
以上兩步未看出啥異常,那就看看apache進程吧
ps -aux|grep apache
好象進程數(shù)是多了點,但也不離譜呀,懶得深究,重啟下apache得了!(自已鄙視自己一下)
無果,還是慢,而且是一啟動就很慢,這就不對勁了!而且很奇怪,一啟動apache的進程數(shù)就達到httpd.conf中設(shè)置的上限了!
以我多年的經(jīng)驗,嘿... 被人盜鏈了!找出病因,下藥就很簡單了!
編輯httpd.conf中加入防盜鏈設(shè)置:
<VirtualHost *:80>
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
<FilesMatch "\.(gif|jpg|png|css|swf)">
Order Allow,Deny
Allow from env=local_ref
</FilesMatch>
</VirtualHost>
其中xxxxx.com改成你自己的域名(喂,你當(dāng)觀眾是豬呀?沒力法,真的有時候就有是豬呢!)
保存后,service httpd restart搞掂收工!
本人原創(chuàng)文章,歡迎轉(zhuǎn)載,轉(zhuǎn)載請注明出處!