Ubuntu Apache Tuning

If you are having problems with your Apache installation, it might be caused by a bad configuration.

You might have a high consumption of CPU as I had.

First of all, you need to know that your Apache config files are located in here

cat /etc/apache2/mods-available/mpm_prefork.conf

Check the values as these might be too high, but don’t worry, we will run a script that will help you tune the values and give you suggestions.

Keep in mind that the script won’t do any modifications to your server, it will only give you recommendations which are usually very accurate.

Make sure that your Apache server has been running for at least 24 hours before running the script or the recommendations will not be good and you will see this warning

*** LOW UPTIME ***

First of all,  install curl on your server if you don’t have it already

apt-get install curl

Then run this command with root

curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl | sudo perl

After the command is executed, you will get a bunch of recommendations, mainly in this section


Check the recommendations and modify as needed.

If you need to modify MaxRequestWorkers, edit this file

vi /etc/apache2/mods-available/mpm_prefork.conf

And then restart Apache as follows

service apache2 restart

It would be good to check again in 24-48 hours to see if everything is running OK.

Just be sure that your apache server has been up for more than 24 hours or the recommendations will not be as good.

Leave a Reply

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