HostwareSupport-Linux Hosting technical support for cPanel, Plesk, Directadmin servers

Linux Hosting technical support for cPanel, Plesk, Directadmin and No control panel servers offers and listing
http://hostwaresupport.com/

Jul 26, 2010

how to optimize apache?

Apache Default connection Limit

Apache by default is limit to server not more than 256 requests per second, so you should do a litle optimization by installing a module and a few configuration of that module to make apache enable to handle more than 256 requests per second.The reason is because to be able to handle all of the request on every server without overloading or crashing server to run on every even simple servers.So if your apache wasn’t configured properly on your powerful server, then by reaching its limit on maxClients , your apache web server will go down repeatedly .follow the following solution to optimize your apache web server:

1-Compiling Apache with needed extra Module

First you must recompile apache with mpm_perfork and if you have cpanel there is an option to add mod_prefork in the easy apache update so add that.This module has been installed and tested on apache running on Centos Linux server.

2 Edit Confiugration of Apache mpm_prefork Module

After recompiling is complete you should now edit this module configuration.You have two choices, whether to create sepprated configuration file and include it in httpd.conf or edit httpd.conf directly that I myself suggest external configuration.I will train both.

2-1 Create External configration file

# nano /etc/httpd/conf/highperformance.conf

If somthing failed due to using the default highperformance.conf then create another file let say highpreformance2.conf , #

nano /usr/local/apache/conf/highpreformance2.conf

2-2 Including configration in httpd.conf

open httpd.conf

nano /usr/local/apache/conf/httpd.conf

* and add this line that contain inclusion of external config file

Include "/usr/local/apache/conf/highperformance.conf"

2-3 Or Editing httpd.conf directly

or you can also directly edit the httpd.conf instead of creation of external file and include it in httpd.conf

Include "/usr/local/apache/conf/highperformance2.conf"

* nano /usr/local/apache/conf/httpd.conf

2-3 Writing your custom prefork configration

After opening the httpd.conf or seprated configration file edit the prefork directives or if “” does not exist add the following completely to it:

ServerLimit 2000

KeepAlive On

KeepAliveTimeout 60

MaxClients 1600

MaxSpareServers 200

MinSpareServers 50

3 Prevent Apache configration from being overwritten

After that you edit apache configration “httpd.conf” directly or included seprated configration then you should run the following command to prevent any changes or overwritten that would be occure to the config with cpanel:

4 Restart Apache for the Changes Take Effect

You are done now but After all modification to apache configration for the changes take effect you need to restart apache webserver

to do so run the following command # /etc/init.d/httpd restart

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------





No comments:

Post a Comment