My website is at /root/website/
, in it there is a folder static
for static files, when the user visit: /static/dfd99a5/xxx.js
, I wish to serve /root/website/static/xxx.js
, how can I do this in nginx?
You can use the rewrite
directive like so:
location ~ ^(/static)/[0-9a-f]+(/.+)$ {
rewrite ^ $1$2 break;
}