HTTP Keep-Alive or HTTP persistent connection is an concept for sending and receiving multiple HTTP requests and responses in single tcp connection. Most of website speed analyzer recommends to enable Keep-Alive for your site.
Let’s edit Apache configuration file and enable Keep-Alive in Apache on CentOS/RedHat Systems. By default Keep-Alive is disabled in Apache server, so follow below step to enable it.
# vim /etc/httpd/conf/httpd.conf
Now change following values as shown below
# # KeepAlive: Whether or not to allow persistent connections #
KeepAlive On# # MaxKeepAliveRequests: The maximum number of requests to allow # during a persistent connection. MaxKeepAliveRequests 100# # KeepAliveTimeout: Number of seconds to wait for the next request from the # same client on the same connection. # KeepAliveTimeout 15
Now restart Apache service using following command and you have successfully enabled Keep-Alive in your Apache server.
# service httpd restart