Apache

SOS,spark!xxx网站打开奇慢,快点给看看,赶紧帮个忙解决。

于是代班超人紧急出动,SSH登录后台,按照俺一贯的二把刀操作手法:

1、检查内存使用情况
free -m

2、查看当前进程情况
top

以上两步未看出啥异常,那就看看apache进程吧
ps -aux|grep apache

好象进程数是多了点,但也不离谱呀,懒得深究,重启下apache得了!(自已鄙视自己一下)

无果,还是慢,而且是一启动就很慢,这就不对劲了!而且很奇怪,一启动apache的进程数就达到httpd.conf中设置的上限了!

以我多年的经验,嘿... 被人盗链了!找出病因,下药就很简单了!

编辑httpd.conf中加入防盗链设置:

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 >   
<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改成你自己的域名(喂,你当观众是猪呀?没力法,真的有时候就有是猪呢!)

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

本人原创文章,欢迎转载,转载请注明出处!

你可能感兴趣的:(apache,html,PHP,css,ssh)