Updated on Mar 13, 2019
Method Type: Server
(this means that this method is handled by the Server side configuration)
Status: Enabled by default on all FastComet Hosting Servers.
The Transmission Control Protocol (TCP) is a core protocol for major internet applications like the World Wide Web, email, file transfer and remote administrator. The Hypertext Transfer Protocol (HTTP) is an application protocol and the foundation of data communication for the World Wide Web.
How Keep-Alive works:
When a TCP connection is opened on it will be sent only one HTTP request /response pair. Keep-Alive is build with the idea of sending multiple HTTP requests/responses via one TCP connection thus significantly reducing the time needed for the web browser to load files from the web server.
Keep-Alive is utilized to the fullest when dealing with static content like images as it allows the requestor to get all of the images from the page using one TCP connection instead of opening new ones for each image. On plain text pages Keep-Alive will not bring a significant improvement because there is little amount of content to be requested, for example an HTML page with a text body will not require more than one TCP connection even if Keep-Alive is disabled. However on media content reach pages it will provide significant improvement in page loading speed.
Keep-alive provides the following Advantages:
If you want to enable Keep-Alive on your own server you can do so via the .htaccess file if the mod headers are supported by your hosting provider.
Then you will need to add this line to your .htaccess file:
<IfModule mod_headers.c> Header set Connection keep-alive </IfModule>
This way you will add keep alive headers to your requests which will force the Keep-Alive method on your connection.
Another way to enable Keep-Alive is by using the Apache config file. You can access it via SSH by navigating to:
From there you can add the following lines to enable Keep-Alive:
<ifModule mod_headers.c> Header set Connection keep-alive </ifModule>
You can also enable this Method by using the cPanel in VHM. You need to access the Apache Configuration section which is located in the Service Configuration menu. Then you will need to click on the Global Configuration option for Apache.
You will now see a lot of configuration options for Apache including the Keep-Alive option which you can turn on.
Hit the Save button at the bottom of the page to apply the change.