n this tutorial we’ll be optimizing the Apache server under VestaCP for better handling of requests, this will also speedup the site as requests are now handled more efficiently with this Apache MPM configs. By default under VestaCP Apache will be using mod_php and prefork mpm hence it is recommended to use prefork when using DSO.
Prefork MPM uses multiple child processes with one thread each and each process handles one connection at a time. So it is recommended to optimize the value rather than using Apache default config. This Multi-Processing Module (MPM) implements a non-threaded, pre-forking web server that handles requests in a manner similar to Apache 1.3. It is appropriate for sites that need to avoid threading for compatibility with non-thread-safe libraries. It is also the best MPM for isolating each request, so that a problem with a single request will not affect any other.
Lets get started with Optimization of Apache server under Centos and Ubuntu.
Under Centos Open this file in editor:
nano /etc/httpd/httpd.conf or nano /etc/httpd/conf/httpd.conf
And add this configs at the end of httpd.conf :
KeepAlive Off <IfModule prefork.c> StartServers 12 MinSpareServers 10 MaxSpareServers 30 ServerLimit 512 MaxClients 256 MaxRequestsPerChild 3000 </IfModule>
Then restart apache server :
service httpd restart