使用apache的朋友可能會(huì)經(jīng)常碰到要調(diào)整apache環(huán)境的連接數(shù)與并發(fā)數(shù)下面我來(lái)給大家介紹怎么修改連接數(shù)/apache并發(fā)數(shù).
Apache的最大連接數(shù),默認(rèn)為256個(gè)。修改apache的最大連接數(shù),方法如下:
步驟一:先修改 /path/apache/conf/httpd.conf文件。
- # vi httpd.conf
- 將“#Include conf/extra/httpd-mpm.conf”前面的 “#” 去掉,保存。
步驟二:再修改 /path/apache/conf/extra/httpd-mpm.conf文件。
- # vi httpd-mpm.conf
找到 這一行,找到文件 /etc/httpd/conf/httpd.conf 并修改下面參數(shù),將默認(rèn)的256改成1000
- KeepAliveTimeout 15
- ##
- ## Server-Pool Size Regulation (MPM specific)
- ##
- # 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
- # ServerLimit: maximum value for MaxClients for the lifetime of the server
- # MaxClients: maximum number of server processes allowed to start
- # MaxRequestsPerChild: maximum number of requests a server process serves
- StartServers 8
- MinSpareServers 5
- MaxSpareServers 20
- ServerLimit 1000
- MaxClients 1000
- MaxRequestsPerChild 4000
- ServerLimit 該指令一定要放在第一行。
修改后,一定不要apachectl restart,而是先 apachectl stop 然后再 apachectl start才可以。
新聞熱點(diǎn)
疑難解答
圖片精選