大网数据广告活动
服务器运维问答

Difference between keepalive in apache2.conf and in ProxyPass

· 52CE 我爱测

I am using Apache 2.2.22 What is the difference, if there is any, between the Keepalive directive in /etc/apache2/apache2.conf # # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection)…

问题原文

原帖链接 · nwtnsqrd · CC BY-SA 4.0

I am using Apache 2.2.22

What is the difference, if there is any, between the Keepalive directive in /etc/apache2/apache2.conf

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

and the directive in the /sites-enabled config when using ProxyPass

 ProxyPass / http://localhost:8080/app/ connectiontimeout=28800 timeout=28800 Keepalive=On

已采纳解答

原帖链接 · Thilina · CC BY-SA 4.0

KeepAlive in main conf

Apache usually uses the HTTP 1.0 protocol to communicate, where it closes the connection after the response. The KeepAlive On parameter here will make apache use HTTP 1.1 where single TCP connection is used to send multiple requests/responses. This makes the server more faster when large number of requests are coming from a single client.

KeepAlive in ProxyPass

Here the Apache will send a KeepAlive probe to the upstream server (which the request is proxied to) to keep the connection alive. This is useful when there is a firewall in between the Apache and the upstream server which drops inactive connections.

Reference

Main conf: https://httpd.apache.org/docs/2.4/mod/core.html

ProxyPass: https://httpd.apache.org/docs/2.2/mod/mod_proxy.html

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-07-06)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。