Apache crash/hangup doesnt serve requests

apache-2.2

at some point apache seems to hang up and not serve requests anymore or they take forever.
i checked the error log. doesnt show any errors
when i do apachctl stop and start apache again it works again

Best Answer

WHAT DO YOUR ERROR LOGS SAY?

grep -i maxclient /var/log/httpd/error_log*

(thinking it might be a maxclient issue.. thus the reason for that search)

Chances are your httpd.conf file needs to be tuned. That being said let's get started.

Virtually almost always httpd.conf is located @ the same place - I am hoping you are comfortable with shell as well as the editor of your choice... I will use NANO in this explanation..

First complete this command:

cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.bkup.beforeItuned

Next use the following command to open the original httpd.conf file in your editor:

nano /etc/httpd/conf/httpd.conf 

Then use "Control-W" to open the search command and type Timeout - you should see something similar to this

Timeout = 120

Change that to

Timeout = 20 

Press the Control-X key and then save the file overwriting the original

Finally - restart Apache using:

/etc/init.d/apache2 restart

Following the aformentioned directions - you can also edit a few other settings:

Be Sure to only do one change at a time to make sure each works... slow is better than major changes and major crashes

Search for the following section: prefork MPM (or just prefork )

<IfModule prefork.c>
StartServers       2
MinSpareServers    1
MaxSpareServers    5
MaxClients         10
MaxRequestsPerChild  1000
</IfModule>

and change to something one of the following - based upon the level of your server:

basic level servers (small resources):

<IfModule prefork.c>
StartServers       1
MinSpareServers    1
MaxSpareServers    3
MaxClients         50
MaxRequestsPerChild  1000
</IfModule>

Medium level servers (medium resources):

<IfModule prefork.c>
StartServers       2
MinSpareServers    2
MaxSpareServers    5
MaxClients         100
MaxRequestsPerChild  1000
</IfModule>

Larger level servers (larger resources):

<IfModule prefork.c>
StartServers       2
MinSpareServers    2
MaxSpareServers    5
MaxClients         200
MaxRequestsPerChild  1000
</IfModule>

Anyhow - these should be a decent start - of course you will want to continue to fine tune to get the best solution.

Happy Editing :-)

did this help you? be sure to vote on this answer

Related Topic