How to Enable KeepAlive in Apache

Last modified: August 2, 2017
You are here:
Estimated reading time: < 1 min

Definition: HTTP Keep-Alive or HTTP persistent connection is a concept for sending and receiving multiple HTTP requests and responses in a single TCP connection.

To enable HTTP Keep-Alive we need to edit the Apache configuration file. By default Keep-Alive is disabled in Apache server, so follow the steps to enable it.

# vim /etc/httpd/conf/httpd.conf

Change or add the 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;

# service httpd restart
Was this article helpful?
Dislike 0
Views: 1
Menu