为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

两种典型web服务器Header设置内容过期方法

2018-04-30 5页 doc 38KB 23阅读

用户头像

is_496339

暂无简介

举报
两种典型web服务器Header设置内容过期方法两种典型web服务器Header设置内容过期方法 一、Internet 信息服务 (IIS)的内容过期设置 如果IIS网站中有时间敏感信息,可以配置设置来保证过期信息不被代理服务器或 Web 浏览器缓存。可以配置网站内容,使之在任何的时间自动过期。当启用内容过期时,Web 浏览器将比较当前日期和截止日期,以便决定是显示缓存页还是从服务器请求更新的页。Microsoft ASP.NET 这样的服务器端技术可用于动态更改提供的内容。通常,时间敏感信息只限于单个文件、目录或网站;不过,您也可以为某台计算机上的所有网站设置内容过期...
两种典型web服务器Header设置内容过期方法
两种典型web服务器Header设置内容过期方法 一、Internet 信息服务 (IIS)的内容过期设置 如果IIS网站中有时间敏感信息,可以配置设置来保证过期信息不被代理服务器或 Web 浏览器缓存。可以配置网站内容,使之在任何的时间自动过期。当启用内容过期时,Web 浏览器将比较当前日期和截止日期,以便决定是显示缓存页还是从服务器请求更新的页。Microsoft ASP.NET 这样的服务器端技术可用于动态更改提供的内容。通常,时间敏感信息只限于单个文件、目录或网站;不过,您也可以为某台计算机上的所有网站设置内容过期。 必须是本地计算机上 Administrators 组的成员或者必须被委派了相应的权限,才能执行下列步骤。作为安全性的最佳操作,请使用不属于 Administrators 组的帐户登录计算机,然后使用运行方式命令以管理员身份运行 IIS管理器 在命令提示符下,键入 runas /user: administrative_accountname"mmc %systemroot%\system32\inetsrv\iis.msc"。 设置网站内容的过期时间 1. 在 IIS 管理器中,展开本地计算机;右键单击要设置内容过期的网站、虚拟目录或 文件,然后单击“属性”。 2. 单击“HTTP 头”选项卡。 3. 选中“启用内容过期”复选框。 4. 单击“立即过期”、“此时间段后过期”或“过期时间”,然后在对应的框中输入 所需的过期信息。 5. 单击“确定”。 The rectification measures: (LED Leadership: Luo Mingjun, rectification time: before September 25th, 1, long-term adherence) to solve the problem of lack of awareness of the harm of Party cadres the "four winds". To further strengthen education and guidance on the implementation of the central eight provisions, the provincial nine provisions of the county committee of the "ten provisions" extensive publicity, eliminate thoughtBarriers 二、APACHE服务的内容过期设置 Apache配置摘录及解释 i. 过期相关设置 LoadModule headers_module modules/mod_headers.so #Load 修改header的模块。 LoadModule expires_module modules/mod_expires.so #Load 设定过期header的模块。 Header append Via: CCN-BJ-4-502 #增加一个Via header,值配置成设备的hostname。 KeepAliveTimeout 60 #设置连接的保持时间为60秒。 ExpiresActive On #启用过期header功能。 ExpiresDefault A604800 #缺省过期时间为“访问后的604800秒” Options FollowSymLinks AllowOverride None Order allow,deny Allow from all ExpiresByType text/html A300 #text/html类型文件的过期设置为“访问后的300秒” ExpiresByType text/css A259200 #text/css类型文件的过期设置为“访问后的259200秒” ExpiresByType application/x-javascript A300 # application/x-javascript类型文件的过期设置为“访问后的300秒” ExpiresByType image/gif A2592000 #image/gif类型文件的过期设置为“访问后的2592000秒” ExpiresByType application/x-shockwave-flash A2592000 # application/x-shockwave-flash类型文件的过期设置为“访问后的2592000秒” provisions of the county committee of the "ten provisions" extensive publicity, eliminate thoughtBarriers nds". To further strengthen education and guidance on the implementation of the central eight provisions, the provincial nineterm adherence) to solve the problem of lack of awareness of the harm of Party cadres the "four wi-The rectification measures: (LED Leadership: Luo Mingjun, rectification time: before September 25th, 1, long2 上述配置文件中load的两个模块:mod_headers.so 和mod_expires.so 可以让Apache具有对header的一些定制功能。 ExpiresByType: 示按照文件类型,MIME-TYPE设定过期策略; A300: 表示在Access后300秒后过期; ExpiresByType text/css A2592000: 表示Mime type是text/css的文件,在Access后2592000秒过期。 ExpiresDefault A604800: 表示除了单独制定的文件类型等过期策略外的其他内容,按照这个缺省的策略设定:访问后604800秒过期。 上面的方法可以实现根据web发布的不同文件类型,针对不同的发布目录进行过期策略设置。在按照如上方法设置后,Apache会自动的产生两个相关的http header,举例如下: HTTP/1.1 200 OK Date: Tue, 27 Mar 2007 17:44:21 GMT Server: Apache/2.0.54 (Unix) Last-Modified: Thu, 25 Jan 2007 07:45:45 GMT ETag: “72df3a-93-99499c40” Accept-Ranges: bytes Content-Length: 147 Cache-Control: max-age=2592000 Expires: Thu, 26 Apr 2007 17:44:21 GMT Via: CCN-BJ-4-575 Keep-Alive: timeout=60, max=100 Connection: Keep-Alive Content-Type: image/gif Length: 147 [image/gif] 其中:Date , Max-age = Expires. Max-age是个时间长度,对应web server 上面设置的过期时间;Expires是根据max-age算出来的过期时间点,两者是一致 的,不同cache在判断内容是否过期时会严格比较系统时间和上述过期时间,或者 比较age(在cache中存住的时间长度)和max-age的值。 tensive publicity, eliminate thoughtBarriersementation of the central eight provisions, the provincial nine provisions of the county committee of the "ten provisions" exeducation and guidance on the impl term adherence) to solve the problem of lack of awareness of the harm of Party cadres the "four winds". To further strengthen-tion measures: (LED Leadership: Luo Mingjun, rectification time: before September 25th, 1, longThe rectifica3
/
本文档为【两种典型web服务器Header设置内容过期方法】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索