centos6.8 apache运行一段时间 访问不了的情况(已解决),centos6.8apache


网站突然一下子访问不了了 

第一反应 重启apache 恢复正常

后续工作就是排查原因

 tail -100 error_log

[Fri Sep 28 11:20:43 2018] [error] server reached MaxClients setting, consider raising the MaxClients setting
[Fri Sep 28 11:25:29 2018] [notice] caught SIGTERM, shutting down
[Fri Sep 28 11:25:30 2018] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Fri Sep 28 11:25:30 2018] [notice] Digest: generating secret for digest authentication ...
[Fri Sep 28 11:25:30 2018] [notice] Digest: done
[Fri Sep 28 11:25:30 2018] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.6.37 mod_ssl/2.2.15 OpenSSL/1.0.1e-fips configured -- resuming normal operations
大体翻译就是当前并发数超过设置链接数

ps -ef | grep httpd | wc -l

查询apache并发连接数

netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

查看linux tcp连接数

/usr/sbin/httpd -l

查看prefork还是worker模式

我这里是prefork模式

去httpd.conf下配置

<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients       256
MaxRequestsPerChild  4000
</IfModule>

修改成

<IfModule prefork.c>
StartServers     100
MinSpareServers  100
MaxSpareServers  100
ServerLimit     1024
MaxClients      1024
MaxRequestsPerChild  4000
</IfModule>

重启apache生效

相关内容

    暂无相关文章