HTTP Keep-Alive 或HTTP持久连接是用于发送和接收一个TCP连接多个HTTP请求和响应的概念。大多数网站的速度分析仪的建议使用 Keep-Alive 为您的网站。 让我们在CentOS / RedHat系统中编辑Apache配置文件并启用 Keep-Alive。默认情况下Apache服务器 Keep-Alive 被禁用,所以按照下面的步骤来启用它。
# vim /etc/httpd/conf/httpd.conf
现在改变以下值,如下所示
#
# 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
现在,使用以下命令重新启动Apache服务,您已成功的在你的Apache服务器上开启Keep-Alive。
# service httpd restart