您的位置:首页 > 运维架构 > Apache

关于apache的优化配置

2013-01-07 16:16 323 查看
     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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: