Reputation: 35720
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?
/root/website/
static
/static/dfd99a5/xxx.js
/root/website/static/xxx.js
Upvotes: 3
Views: 4925
Reputation: 27218
You can use the rewrite directive like so:
rewrite
location ~ ^(/static)/[0-9a-f]+(/.+)$ { rewrite ^ $1$2 break; }
Upvotes: 2