标签: nginx url-rewriting nginx-location auto-versioning ngx-http-rewrite-module
我的网站位于/root/website/,其中有一个文件夹static用于静态文件,当用户访问:/static/dfd99a5/xxx.js时,我希望提供/root/website/static/xxx.js,如何我可以在nginx中这样做吗?
/root/website/
static
/static/dfd99a5/xxx.js
/root/website/static/xxx.js
答案 0 :(得分:1)
您可以使用rewrite指令,如下所示:
rewrite
location ~ ^(/static)/[0-9a-f]+(/.+)$ { rewrite ^ $1$2 break; }