This article describes how to use keep-alive connections in Apache to help improve performance.
Keep-alive connections use a single TCP connection to handle multiple HTTP requests and responses. Instead of opening a new TCP connection every time a brower sends a request, keep-alive connections enable clients and servers to communicate more efficiently and use fewer resources.
Many performance testing sites, such as GTMetrix, check if keep-alive connections are enabled for a site. If they are disabled, you receive a lower site performance score.
If keep-alive conections are disabled for your site, you can easily enable them. To do this, follow these steps:
<IfModule mod_headers.c> Header set Connection keep-alive </IfModule>
Save your changes to the .htaccess file. Keep-alive connections are now enabled.
To verify that keep-alive connections are enabled, you can examine the raw HTTP headers sent between the browser and web server. To do this, use a browser plugin that displays the raw headers such as Live HTTP headers for Mozilla Firefox, or the Developer Tools feature in Google Chrome. When keep-alive connections are enabled, Apache adds the following line to the HTTP response header:
Connection: Keep-Alive
For more information about keep-alive connections, please visit https://en.wikipedia.org/wiki/HTTP_persistent_connection.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.