【发布时间】:2013-10-21 19:26:13
【问题描述】:
在我的 nginx 配置中,我有一些图像的 url 重写规则,如下所示:
location / {
rewrite ^/custom/path/(.*)/(.*)-(.*).jpg$ /media/images/products/$1/$3.jpg last;
}
它们工作得很好。我还尝试为所有静态资源(图像、css、js)设置Expire 标头。我为此添加了以下块:
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 1y;
}
这适用于除具有 url 重写规则(返回 404 Not found)的图像之外的所有内容。有谁知道我在这里做错了什么?
【问题讨论】:
标签: url-rewriting nginx http-headers