Chinaunix首页 | 论坛 | 博客
  • 博客访问: 111723
  • 博文数量: 27
  • 博客积分: 1163
  • 博客等级: 少尉
  • 技术积分: 240
  • 用 户 组: 普通用户
  • 注册时间: 2005-10-18 15:35
文章分类

全部博文(27)

文章存档

2010年(5)

2009年(5)

2008年(1)

2007年(5)

2006年(4)

2005年(7)

分类: LINUX

2007-07-31 10:52:55

 
 
解压软件
# tar zxvf httpd-2.0.47.tar.gz
mod_limitipconn是一个限制同一IP连接次数的模块
# tar zxvf mod_limitipconn-0.22.tar.gz
# cd /setup/httpd-2.0.47
给apache打补丁,支持同一ip连接的代理跟踪
# patch -p1 < ../mod_limitipconn-0.22/apachesrc.diff
# ./configure --prefix=/usr/local/apache --datadir=/opt/html --with-mpm=worker --with-module=aaa:../mod_limitipconn-0.22/mod_limitipconn.c --enable-forward
          1.启用线程和进程混合的多道处理模块worker,默认是prefock,即1.3里面的纯进程工作模式,注意,这里如果选择worker的话,那么后面编译PHP的时候是不能选择MM(使用内存来保存会话信息)的支持的!ZendPerformanceSuite只能工作在prefock工作模式!!!
          2.静态编译mod_limitipconn模块到httpd内部(如果你想动态加载安装那就自己去看看README好了,很简单的)
          3.激活同一ip的代理连接跟踪,打的补丁也是针对这个的
# make 
# make install          

# /usr/local/apache/bin/httpd -l
查看编译的模块,注意一下是否有mod_limitipconn的输出。
 
#################修改apache配置文件######################
# vi /usr/local/apache/conf/httpd.conf
Section 1: Global Environment  部分需要修改如下内容
 
 
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves

StartServers         3
MaxClients         480
MinSpareThreads     50
MaxSpareThreads    200 
ThreadsPerChild     60
MaxRequestsPerChild  0
##################################################################################
#
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
#ExtendedStatus On [把#删除]
ExtendedStatus On

### Section 2: 'Main' server configuration   部分需要修改如下内容
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# redirections will not work.  See also the UseCanonicalName directive.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# redirections work in a sensible way.
#
ServerName 127.0.0.1:80

###################################################################################
 
#添加mod_limitipconn.c模块及配置

    
         MaxConnPerIP 2    # 每IP只允许2个并发连接
    

 
### Section 3: Virtual Hosts  需要添加如下部分

        ServerAdmin    
        DocumentRoot    /opt/html
        ServerName      down.abc.com
        ErrorLog        /opt/download/logs/patch-error.log   
        CustomLog       /opt/download/logs/patch-access.log common
阅读(1418) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~