关于apache的优化配置

     apache的默认工作模式是event.c ,查看其工作模式是在apache安装目录的bin下面进行如下命令:

      ./apachectl -l 显示如下:

      Compiled in modules:
        core.c
        mod_so.c
        http_core.c
         event.c

                  其默认是event.c,另在conf目录下的extra目录运行以命令:

      vi httpd-mpm.conf 查看其模式配置:

       # prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxRequestWorkers: maximum number of server processes allowed to start
# MaxConnectionsPerChild: maximum number of connections a server process serves
#                         before terminating
<IfModule mpm_prefork_module>
    StartServers             5
    MinSpareServers          5
    MaxSpareServers         10
    MaxRequestWorkers      250
    MaxConnectionsPerChild   0
</IfModule>


# worker MPM
# StartServers: initial number of server processes to start
# 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
# MaxRequestWorkers: maximum number of worker threads
# MaxConnectionsPerChild: maximum number of connections a server process serves
#                         before terminating
<IfModule mpm_worker_module>
    StartServers             3
    MinSpareThreads         75
    MaxSpareThreads        250
    ThreadsPerChild         25
    MaxRequestWorkers      400
    MaxConnectionsPerChild   0
</IfModule>


  由于上面默认是event.c的模式,因此需要到源文件下面make clen,删除掉apche目录重新安装,执行以下命令:

  ./configure --prefix=/usr/local/apache  --enable-module=all --with-apr=/usr/local/apr-1.4.6 --with-apr-util=/usr/local/apr-util-1.5.1  --with-pcre=/usr/local/pcre-8.32/ --with-included-apr --with-mpm=worker --enable-cache-disk --enable-file-cache --enable-so

   此处需要将with-included-apr加上,不然加载模块会出错,另外要将需要把apr和apr-util的源文件copy到httpd的源文件的目录srclib下面

   cp -r apr-1.4.6 httpd-2.4.3/srclib/apr
   cp -r apr-util-1.5.1 httpd-2.4.3/srclib/apr-util

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值