One Simple Apache httpd.conf Change to Speed Up Page Loads

Apache-Web-ServerThe Apache httpd.conf file can be overwhelming and complex, but if you make one simple change it can have a big impact. By default the “keepalive” feature is turned off. Turning that on will help people loading your web pages get them faster and cause less burden on your server. Here is how to change keepalive.

You will first need to locate your httpd.conf file. It will be in your Apache conf directory. That may be somewhere like /etc/httpd/conf, but if you’re unsure run the command:

httpd -V

The line that says HTTPD_ROOT should help you find it.

Create a backup copy of the file.

cp httpd.conf httpd.conf.bak

Then edit the file (with vi or your favorite text editor) and find the phrase “KeepAlive” and change “Off” to “On” as seen here:

# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

Save the file and restart Apache.

apachectl -k restart

OR

service httpd restart

For a good before and after run Google PageSpeed before any changes and then again after changes. A more in depth test from a geography of your choosing can be done with WebPagetest.

If something goes wrong just replace the modified file with the copy you made.

Image: Apache Foundation

Leave a comment

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