- Forums
- Linux Hosting
- How To Optimize Apache Server To Run Faster
this tutorial will show you how you can optimize your apache web server using the httpd.conf file it will show you step by step what changes you need to make [526], Last Updated: Sat May 18, 2024
wallpaperama
Sun Jan 30, 2011
0 Comments
1712 Visits
hi everyone,
today i am going to show you a little trick what you can do to make your apache server server more users on your website. for example, your website has alot of users and visitors, its helpful to increase the capacity in your apache configuration files.
for example, today i will show you the commands you need to do to increase the MaxClients and MaxSpareThreads
you will find these setting in the httpd.conf file. if you have a redhat-like server like centos or fedora for example, send this command:
before anything, lets make a backup of the original configuration file so send this command
this command will make a backup copy of the httpd.conf to a file called httpd.conf.bak
cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.bak
once we have made a backup file, lets edit the httpd.conf file with this command:
nano /etc/httpd/conf/httpd.conf
* NOTICE: notice i am using nano as my text editor, you can use vi or whatever text editor you prefer. i use nano because its easier for me
once you are in nano, look for the word
MaxClientsso search in nano, just hit Control+w enter the keyword and then hi enter then change to the following settings like mine:
##
## 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
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 300
MaxClients 300
MaxRequestsPerChild 4000
# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers 2
MaxClients 300
MinSpareThreads 25
MaxSpareThreads 300
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
once you have completed making the changes, save the changes by hiting control+x
in order for the new changes to take affect, you must restart your apache server so send this command:
/etc/init.d/httpd restart
done