2

如何检查并查看我的 Web 服务器是否正在提供带有压缩和远期过期标头的内容?即使我已将以下项目添加到.htaccess文件中,YSlow 仍然告诉我,我有以纯文本形式发送且没有“远期”过期标头的资源:

<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault A0
    ExpiresByType image/gif A2592000
    ExpiresByType image/png A2592000
    ExpiresByType image/jpg A2592000
    ExpiresByType image/jpeg A2592000
    ExpiresByType image/ico A2592000
    ExpiresByType image/x-icon A2592000
    ExpiresByType text/css A2592000
    ExpiresByType text/javascript A2592000
</IfModule>

图片.png

它说需要过期标头的其中一件事是 favicon.ico 文件,以下是 Firebug 中列出的标头:

HTTP/1.1 200 OK
Date: Sun, 18 Sep 2011 00:50:03 GMT
Server: Apache
Last-Modified: Tue, 21 Dec 2010 21:47:19 GMT
Etag: "f8233-47e-497f294aba7c0"
Accept-Ranges: bytes
Content-Length: 1150
Cache-Control: max-age=0
Expires: Sun, 18 Sep 2011 00:50:03 GMT
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: image/x-icon

它说需要压缩的资源之一是主 index.php 文件,它不发送自己的 AFAIK 的标头。这是响应标头:

HTTP/1.1 200 OK
Date: Sun, 18 Sep 2011 00:49:33 GMT
Server: Apache
X-Powered-By: PHP/5.3.6
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=754163feea6fab8a8d6d7f0ef6ed3c29; path=/
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html

我正在尝试使用mod_deflate,因为这是一个 Apache 2 服务器。

我做错了什么,我可以检查什么,以及如何进一步测试?

它还告诉我“有 17 个组件的 ETag 配置错误”——也不确定这意味着什么。电子标签在标题中,我觉得它们看起来不错。

4

1 回答 1

1

对于 mod_deflate 我推荐这个测试

于 2011-09-18T01:01:00.710 回答