【发布时间】:2021-10-31 18:07:08
【问题描述】:
我使用 nginx 作为 Apache 服务器的前端来提供静态文件,主要是这样的图像:
location / {
expires 15m;
proxy_pass http://127.0.0.1:8080;
}
location ~* \.(jpg|gif|png|ico|svg)$ {
expires 1M;
}
问题:如何将一些图像文件永久重定向到新位置?
如果是 Apache,我会使用以下指令:
Redirect permanent /deleted_dir/some_image.gif /image/some_image.gif
Redirect permanent /deleted_dir/other_image.gif /image/new_image.jpg
我怎样才能用 nginx 做到这一点? 谢谢。
【问题讨论】: