apache shuts down because MaxClients reached

10,367

Since your server is running prefork mode, this means that each connection gets its own process - so first of all check to see whether there are 1024 or so httpd processes running on the system.

To get a better handle on what your server is doing you may want to enable the server-status page.

LoadModule status_module modules/mod_status.so

ExtendedStatus On

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from .example.com
</Location>

This will then allow you to view the state of connections to your server and try to figure out just what's causing all the connections to be consumed.

My suspicion is the possibility of some kind of rogue proxy or rewrite statement which is causing the server to continually loop its connections within itself until all of them are consumed.

Share:
10,367

Related videos on Youtube

Roman
Author by

Roman

student of FIT VUT in Brno, programmer and administrator

Updated on September 17, 2022

Comments

  • Roman
    Roman almost 2 years

    have a serious problem. I've got virtual server which runs Apache and two web project with a lot of visitors (about 5 hits per second). My server starts to shut down by itself. In error log I found this problem

    [error] server reached MaxClients setting, consider raising the MaxClients setting
    [notice] caught SIGTERM, shutting down
    

    so I search for solution to raise these numbers. I discover that this number is in two section in apache confinguration. With

    /usr/sbin/httpd -l
    Compiled in modules:
      core.c
      prefork.c
      http_core.c
      mod_so.c
    

    I found that my server is using prefork. So I again search for proper values and tried these

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

    but server still shuts down even with these values. Can anybody guide me where to look, what to read, or what to set for proper stable run of server? I will appreciate any help, folks.

    The server runs Linux CentOS 5.4

    Thx beny