CentOS下的LAMP环境之虚拟主机
创始人
2024-07-22 18:11:16
0

CentOS下的LAMP环境之虚拟主机(大纲)

  四、配置虚拟主机及基本性能调优

  1) 配置虚拟主机:

  1.   #vi /usr/local/apache2/conf/extra/httpd-vhosts.conf  
  2.  

  代码:

  1.   NameVirtualHost *:80  
  2.  
  3.     
  4.  
  5.   ServerAdmin cnseek@gmail.com  
  6.  
  7.   DocumentRoot "/data/www/wwwroot/linuxtone.org"  
  8.  
  9.   ServerName www.linuxtone.org  
  10.  
  11.   ServerAlias bbs.linxutone.org  
  12.  
  13.   ErrorLog "logs/dummy-host.example.com-error_log"  
  14.  
  15.   CustomLog "|/usr/sbin/cronolog /data/logs/access_www.linuxtone.org.%Y%m%d"  
  16.  
  17.   combined  
  18.  

  2).基本性能调优参考

  #vi /usr/local/apache2/conf/extra/httpd-default.conf

  复制内容到剪贴板

  代码:

  1.   Timeout 15  
  2.  
  3.   KeepAlive Off  
  4.  
  5.   MaxKeepAliveRequests 50  
  6.  
  7.   KeepAliveTimeout 5  
  8.  
  9.   UseCanonicalName Off  
  10.  
  11.   AccessFileName .htaccess  
  12.  
  13.   ServerTokens Prod  
  14.  
  15.   ServerSignature Off  
  16.  
  17.   HostnameLookups Off  
  18.  
  19.   #vi /usr/local/apache2/conf/extra/httpd-mpm.conf  
  20.  

  代码:  

  1.   ServerLimit 2000  
  2.  
  3.   StartServers 10  
  4.  
  5.   MinSpareServers 10  
  6.  
  7.   MaxSpareServers 15  
  8.  
  9.   MaxClients 2000  
  10.  
  11.   MaxRequestsPerChild 10000  
  12.  

  

  3).Apache日志处理相关问题汇总贴

  利用awstats分析网站日志:http://bbs.linuxtone.org/thread-56-1-1.html

  忽略不需要的日志配置参考具体请据据具体问题分析:

  LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\"

  \"%{User-Agent}i\"" combined

  #下面加入如下内容:

  代码:

  1.   # filter the localhost visit  
  2.  
  3.   SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog  
  4.  
  5.   # filter some special directories  
  6.  
  7.   SetEnvIf Request_URI "^ZendPlatform.*$" dontlog  
  8.  
  9.   SetEnvIf Request_URI \.healthcheck\.html$ dontlog  
  10.  
  11.   SetEnvIf Remote_Addr "::1" dontlog  
  12.  
  13.   SetEnvIf Request_URI "\.getPing.php$" dontlog  
  14.  
  15.   SetEnvIf Request_URI "^/error\.html$" dontlog  
  16.  
  17.   SetEnvIf Request_URI "\.gif$" dontlog  
  18.  
  19.   SetEnvIf Request_URI "\.jpg$" dontlog  
  20.  
  21.   SetEnvIf Request_URI "\.css$" dontlog  
  22.  

  4). Apache防盗链(Apache防盗链相关问题汇总:http://bbs.linuxtone.org/thread-101-1-1.html)

  代码:

  1.   RewriteEngine on  
  2.  
  3.   RewriteCond %{HTTP_REFERER} !^$  
  4.  
  5.   RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]  
  6.  
  7.   RewriteRule \.(gif|jpg)$ http://网站域名/nolink.png [R,L]  

 

【编辑推荐】

  1. Ubuntu下LAMP的搭建
  2. Centos下搭建LAMP
  3. Linux下LAMP的安装方法

相关内容

热门资讯

如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
施耐德电气数据中心整体解决方案... 近日,全球能效管理专家施耐德电气正式启动大型体验活动“能效中国行——2012卡车巡展”,作为该活动的...
20个非常棒的扁平设计免费资源 Apple设备的平面图标PSD免费平板UI 平板UI套件24平图标Freen平板UI套件PSD径向平...
德国电信门户网站可实时显示全球... 德国电信周三推出一个门户网站,直观地实时提供其安装在全球各地的传感器网络检测到的网络攻击状况。该网站...
为啥国人偏爱 Mybatis,... 关于 SQL 和 ORM 的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行...
《非诚勿扰》红人闫凤娇被曝厕所... 【51CTO.com 综合消息360安全专家提醒说,“闫凤娇”、“非诚勿扰”已经被黑客盯上成为了“木...
2012年第四季度互联网状况报... [[71653]]  北京时间4月25日消息,据国外媒体报道,全球知名的云平台公司Akamai Te...