Discover how to improve the performance of your Apache server configuration with the help of a must-use Perl script.
Apache server software, out of the box, is impeccably well designed. By doing very little, you can have a blazingly fast web server up and running with a single command: sudo apt-get install lamp-server^.
But where can Apache admins turn in order to get the most out of their web server? Do you comb through httpd.conf or apache2.conf for possible issues? Do you look through /etc/apache2/sites-enabled to make sure all of your directives are clear and well defined?
What if I told you there is a Perl script that will comb through your Apache setup and report back crucial improvements that can be made to your configuration? The script is apache2buddy.pl (a fork of apachebuddy), and it can do more for your web server in seconds than the hours it would take to sift through everything.
The script doesn't fix your problems—once it's run, the script will suggest fixes for Apache that you can then read through and act upon. The apache2buddy.pl script will check for the following and much more:
- PHP memory limits
- Memory usage
- Max potential memory usage
- Percentage of total RAM allocated to Apache
After you fix the issues suggested by apache2buddy.pl, you'll find your Apache server is significantly improved.
Let's download, run, and fix some problems with an Apache server running on Ubuntu Server 16.04.
SEE: Secure equipment repair policy and confidentiality agreement (Tech Pro Research)
Downloading and running
The apache2buddy.pl script is run from the command line. To successfully run the script, follow these steps.
- Open a terminal window.
- Issue the command sudo su. (If you're running a distribution that doesn't use sudo, omit sudo from the command.)
- Type your sudo (or root) password and hit the Enter key on your keyboard.
- Issue the command curl -L http://apache2buddy.pl/ | perl.
- Allow the script to run.
When the script completes, it will immediately report its findings (Figure A).
Solving the reported issues
The most glaring issue apache2buddy.pl found on my test server was a low MaxRequestWorkers setting.
The MaxRequestWorkers directive sets the limit on the number of requests that will be served simultaneously. In my configuration, MaxRequestWorkers was set to 150 (the default); however, the recommended setting is between 179-197. This particular directive is configured in /etc/apache2/mods-enabled/mpm_prefork.conf. As you can see in Figure B, apache2buddy.pl was correct, and MaxRequestWorkers is set to 150.
After making that change, I restarted Apache with the command service apache2 restart and re-ran the apache2buddy.pl test. I intentionally set MaxRequestWorkers to 199 to see how apache2buddy.pl would react. Sure enough, it declared the directive set was too high (Figure C).
Once MaxRequestWorkers was set to 197, all was well.
Go through the entirety of the apache2buddy.pl findings and resolve all the reported issues, and then restart Apache—your web server will perform like never before.
A must-use script
The apache2buddy.pl script is a must for anyone that administers an Apache server. With very little time and effort, you can tune your web server to near perfection.
Give apache2buddy.pl a try, and see if it doesn't drastically increase the performance of your Apache deployment.
- How to deploy a Samba domain controller in under 10 minutes (TechRepublic)
- How to add users to shares with the TurnKey Linux FileServer appliance (TechRepublic)
- How to set up auto rsync backups using ssh (TechRepublic)
- How to install a LAMP server on openSUSE (TechRepublic)
- How to install a LAMP stack on CentOS (TechRepublic)
- Oracle abandons NetBeans to Apache (ZDNet)