#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-mysql make make 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鏈接,只有第一個請求會被計數。事實上,它改變了每個子進程限制最大鏈接數量的行爲。