Websterz Technology Blog

Free tutorials, Tech News, Source codes, Tweaks and Tips.

In this post i will describe how to decrease memory usage of apache2, i tried to search on google and found many solution to that problem but nothing worked for me. So i discovered a way to decrease the memory usage of apache2.

Apache
Apache

Here is the solution:

  • Login to your server via putty / shell terminal with root access.
  • Execute following command:
# cd /etc/apache2
# nano apache2.conf
  • A text editor will appear with apache2 configuration file find the below line in it:
KeepAlive On
  • Replace this line with:
KeepAlive Off
  • Press CTRL+O to and then press [Enter] to save the changes. now run the following command:
# /etc/init.d/httpd restart
OR
# /etc/init.d/apache2 restart
OR
# service apache2 restart
OR
# service httpd restart
  • This will restart your apache2 server and now the RAM usage will decrease to 50% guaranteed.

For cPanel/WHM:

You can do the above configurations from your WHM/cPanel interface if you are running WHM/cPanel on your server. Follow the below steps:

  • Login to your WHM/cPanel with root username and password.
  • In the left panel under Service Configurations find Apache Configurations click on the link.
  • The new window will appear click on first option Global Configuration
  • Now find the option KeepAlive on that page and turn it to off, and then save the settings.
  • On the next page you will be asked to Rebuild Configurations and restart Apache Just press that button and you are done.
Feedback will be appreciated 🙂
Spread the love
See also  The mod_security plugin could not connect to the database. Please verify that MySQL is running. Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) - Solution

Leave a Reply

Your email address will not be published. Required fields are marked *