如何在Apache上CentOS/RHEL上启用KeepAlive

时间:2019-05-19 01:25:59  来源:igfitidea点击:

HTTP持久连接是在一个tcp连接中发送和接收多个HTTP请求和响应的概念。
大多数网站速度分析器建议,使保持活着为网站。
让我们编辑Apache配置文件,并在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