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

Apache最大连接数/apache并发数修改方法

2017-02-13 16:36 417 查看
Apache的最大连接数,默认为256个。

修改apache的最大连接数,方法如下:

步骤一

先修改 /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 并修改下面参数,将默认的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才可以。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: