Apache中的.htaccess正确使用的KeepAlive的 [英] Proper use of KeepAlive in Apache Htaccess

查看:194
本文介绍了Apache中的.htaccess正确使用的KeepAlive的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之间的区别是什么:

头设置连接保持活动

的KeepAlive上

在Apache的htaccess的?

in Apache htaccess?

什么code,我们必须放在一个PHP文件的头选项?什么htaccess的文件吗?

What code and options we have to put in the header of a php file? And what in htaccess file?

推荐答案

如果您简单地将头连接:保持活动它不会是不够的。客户端将认为这是一个保持活动连接,但服务器可以决定关闭连接。此外,客户端不知道有多少请求可以通过保持活动连接提供服务。还有用于跟踪通过保持活动连接,看起来像这样的请求报文的附加头:

If you simply set the header Connection: keep-alive it isn't going to be enough. The client will think it's a keep-alive connection but the server may decide to close the connection. Additionally, the client doesn't know how many requests can be served through the keep-alive connection. There's an additional header that is used to track requests sent through a keep-alive connection that looks like this:

Keep-Alive: timeout=15, max=100

它告诉客户端,它最多可发送100个请求对当前保持活动连接(和倒计时,你继续使用表示保持活动连接),客户端有15秒的时间做出任何additioanl连接前请求被关闭。

which tells the client that it can send up to 100 more requests on the current keep-alive connection (and it counts down as you continue to use said keep-alive connection) and that the client has 15 seconds to make any additioanl requests before the connection is closed.

只需用头不足以建立永葆连接,因为服务器需要协商的。两端需要了解的保活和两端需要做适当的会计。你需要告诉Apache处理保活在它的结束,简单地发送头是不会做的。您需要打开保活在使用第二个指令:

Simply using the header isn't sufficient to establish a keep alive connection because the server needs to negotiate it. Both ends need to know about the keep-alive and both ends need to do proper accounting. You need to tell apache to handle keep-alive on its end and simply sending the header isn't going to do that. You need to turn keep-alive on using the second directive:

KeepAlive on

,另外,你可以调整保活机制,类似指令:

And additionally, you can tweak the keep-alive mechanism with directives like:

KeepAliveTimeout 15
MaxKeepAliveRequests 100

这篇关于Apache中的.htaccess正确使用的KeepAlive的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆