#apr

 cd /tmp/upgrade/

 tar zxvf apr-1.4.8.tar.gz 

 cd apr-1.4.8

 ./configure --prefix=/apache/apr

 make && make install

#apr-util

 cd ..

 tar zxvf apr-util-1.5.2.tar.gz 

 cd apr-util-1.5.2

 ./configure --prefix=/apache/apr-util --with-apr=/apache/apr/bin/apr-1-config 

 make && make install

#pcre 

 cd ..

 tar zxvf pcre-8.33.tar.gz

 ./configure --prefix=/apache/pcre

 make && make install

 

#OpenSSL

./config --prefix=/apache/ssl -fPIC no-gost no-shared no-zlib 

make depend

make && make install

 

#httpd

 cd ..

 tar zxvf httpd-2.4.6.tar.gz

 cd httpd-2.4.6

 cp -r ../apr-1.4.8 srclib/apr

 cp -r ../apr-util-1.5.2 srclib/apr-util

 ./configure --prefix=/apache/apache2 --with-included-apr --with-apr=/apache/apr/bin/apr-1-config --with-apr-util=/apache/apr-util --with-pcre=/apache/pcre/bin/pcre-config --with-mpm=worker --with-ssl=/apache/ssl --enable-ssl --enable-so --enable-headers --enable-deflate --enable-rewrite --enable-status --enable-info --enable-setenvif --disable-cgi

 make && make install

cd ../php-NN./configure --with-apxs2=/apache/apache2/bin/apxs --with-mysqlmakemake install

If you decide to install the apr-1.4.6 and apr-util-1.4.1 on your system, you need to use “–with-apr” and “–with-apr-util” and provide the path where you installed these utility.

In this example, we didn’t do that. i.e We didn’t install the apr and apr-util that we downloaded. Instead we placed them under the httpd-2.4.2/srclib/apr-util. So, we should use “–with-included-apr” in the ./configure which will use these apr and apr-util only for the apache compilation and installation.

prefork:

默认的MaxClient最大是256个线程,如果想设置更大的值,就的加上ServerLimit这个参数。20000是ServerLimit这个参数的最大值。如果需要更大,则必须编译apache,此前都是不需要重新编译Apache。
生效前提:必须放在其他指令的前面

worker:

控制这个MPM的最重要的指令是,控制每个子进程允许建立的线程数的ThreadsPerChild指令,和控制允许建立的总线程数的MaxClients指令

MaxClients
允许同时伺服的最大接入请求数量(最大线程数量)。任何超过MaxClients限制的请求都将进入等候队列。默认值是"400",16(ServerLimit)乘以25(ThreadsPerChild)的结果。因此要增加MaxClients的时候,你必须同时增加ServerLimit的值。

MaxSpareThreads
设置最大空闲线程数。默认值是"250"。这个MPM将基于整个服务器监视空闲线程数。如果服务器中总的空闲线程数太多,子进程将杀死多余的空闲线程。MaxSpareThreads的取值范围是有限制的。Apache将按照如下限制自动修正你设置的值:worker要求其大于等于MinSpareThreads加上ThreadsPerChild的和。

MaxRequestsPerChild
设置每个子进程在其生存期内允许伺服的最大请求数量。到达MaxRequestsPerChild的限制后,子进程将会结束。如果MaxRequestsPerChild为"0",子进程将永远不会结束。将MaxRequestsPerChild设置成非零值有两个好处:
1.可以防止(偶然的)内存泄漏无限进行,从而耗尽内存。
2.给进程一个有限寿命,从而有助于当服务器负载减轻的时候减少活动进程的数量。
注意对于KeepAlive链接,只有第一个请求会被计数。事实上,它改变了每个子进程限制最大链接数量的行为。