精彩专题推荐:建站之入门课 建站之必修课 建站之关键课 网站价值所在 流量提高专题 css+div 标准 个人网站打造全过程
返回建站学首页
导航:
建站首页 | 网站设计 | 网站开发 | 网站运营 | 网页软件 | 建站指南 | 搜索优化 | 图像处理 | 视频教程 | 书籍教程 | 建站专题
当前位置:首页>建站指南>网站空间>正文

Linux攻略 关于Apache安装、配置、优化


来源:不详 时间:07-09-28 点击: 点击这里收藏本文

  
  代码:

# vi /etc/profile
   PATH=" $PATH:usr/local/apache2/bin:”
  
  配置 apache2.0

  代码:

# vi /usr/local/apache2/conf/httpd.conf
  
  配置文件请看文件 httpd.conf (设置文档目录为/home/dalouis/public_html)
  
  代码:

#chmod 755 – R /home/dalouis/
  
  设置目录的可读性为 drwxr-xr-x(755), 否则会出现 "Forbidden You don't have permission to access / on this server."
  
  一些关于安全性的配置:
  
  考虑到 cgi-bin 的安全性问题,我们暂时将 cgi-bin 去掉。将所有 httpd.conf 中的所有关于 cgi-bin 的行加上 #.

  Xiyang 的配置

  我用的: mod_limitipconn, mod_expires, mod_gzip, mod_php4, mod_so, mod_access, mod_alias, mod_userdir, mod_dir, mod_autoindex, mod_status, mod_mime, mod_log_config, http_core
  
  关于超时的问题

  在我编写好所有的产品查看页面的时候,经常会出现因为超时,或者流量过大 ,apache 停止工作的问题,原因有二,一是代码的不科学性,二是 apache 的设置问题。
  
  以下是对设置的一点改动:
  
  代码:

# KeepAlive: Whether or not to allow persistent connections(more than
   # one request per connection). Set to "Off" to deactivate.
     # KeepAlive Off
     # MaxKeepAliveRequests: The maximum number of requests to allow
   # during a persistent connection. Set to 0 to allow an unlimited amount.
   # We recommend you leave this number high, for maximum performance.
     # MaxKeepAliveRequests 0
    # KeepAliveTimeout: Number of seconds to wait for the next request
   # from the same client on the same connection.
     # KeepAliveTimeout 0

  • 记录访问者的 HTTP-REFERER 和 AGENT, 有助于统计来者是通过什么搜索引擎找到我们的网站的。 或者在原有的CustomLog行,将参数由 common 改成 combined

  代码:

# If you would like to have agent and referer logfiles,
   # uncomment the following directives.
   CustomLog logs/referer_log referer
         CustomLog logs/agent_log agent
   CustomLog logs/www.domain.com-access_log combined

  使用 mod_limitipconn.c 来限制 apache 的并发数
  
  Package: http://dominia.org/djao/limit/这里的安装建议使用动态 DSO 并 patch apache2.0, 以使得 apache2.0 可以认识在代理后方的 IP 。但是要 重新编译 apache2.0, 以下是介绍。
  
  代码:

##Instructions for building DSO with proxy tracking:
   # tar xzvf httpd-2.0.39.tar.gz
   # tar xzvf mod_limitipconn-0.22.tar.gz
   # cd httpd-2.0.39
   # patch -p1 < ../mod_limitipconn-0.22/apachesrc.diff
   # ./buildconf
   # ./configure --enable-so --enable-speling --enable-rewrite
--with-ssl=/usr/local/ssl --enable-forward
   # make
   # make install
   # cd ../mod_limitipconn-0.22
   # PATH=/usr/local/apache2/bin:$PATH
   # make install

  安装过程

# lynx http://dominia.org/djao/limit/mod_limitipconn-0.22.tar.gz
   # tar -zxvf mod_limitipconn-0.22.tar.gz
   # cd httpd-2.0.48
   # patch -p1 < ../mod_limitipconn-0.22/apachesrc.diff
   patching file configure.in
   Hunk #1 succeeded at 373 (offset 55 lines).
   patching file include/scoreboard.h
   patching file modules/generators/mod_status.c
   Hunk #1 succeeded at 746 (offset -1 lines).

9 7 3 1 2 4 8 :

  把此文章收藏到:          
广而告之
文章搜索
  • Google JZxue.Com

关于我们 | 联系我们 | 友情链接 | 网站地图
Copyright © 2005 - 2006 建站学 All rights reserved.