为什么nginx不缓存扩展名为.html的脚本


Why nginx does not cache scripts with .html extension?

我有nginx/1.4.2+Apache,我想用nginx缓存所有请求。此位置规则为.php创建缓存文件,但不为.html:创建缓存文件

    location ~* '.(html|php)$ {
            proxy_pass http://127.0.0.1:8080;
            proxy_set_header Host my-host-name.com;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Real-IP $remote_addr;
            add_header cache "html";
            proxy_cache default;
            proxy_cache_min_uses 1;
            proxy_cache_valid  1d;
            proxy_cache_key "$host|$request_uri";
            proxy_hide_header "Set-Cookie";
            proxy_ignore_headers "Cache-Control" "Expires";
    }

标头"缓存"已添加到响应中,因此位置正在工作。

我尝试过"location/"-对缓存中存储的扩展名为.php(且没有任何扩展名)的脚本的请求。对于扩展名为.html的脚本,nginx不创建缓存。

我找不到nginx忽略扩展名为.html的脚本的原因。将脚本重命名为.php-这不是办法。我有CMS,它为html页面提供了可读的URL,谷歌索引中有数千个页面,现在重命名会导致网站重新索引。

可能是因为CMS返回Set-Cookie标头。