nginx 404 expires
location~*\.(ico|css|js|gif|jpg|png)${
>expires7d;
>}
>IfIaddthistomyserverconfitwillcauseallthoserequests
>tofailwitha404..I'mfeelingsillyformissingthis,andI
>knowit'sprobablyveryeasytofix...buthow?
Mostlikelyyouhavesomethinglikethis:
root/path/to/nowhere;
location/{
root/path/to/root;
}
Adding
location~*\.(ico|css|js|gif|jpg|png)${
expires7d;
}
resultsinthesefilesbeingsearchedinnowhere.Thereasonis
simple:nginxusesconfigurationin"location~*\.(...)$"which
hasnorootexplicitlyset,andthereforerootisinheritedfrom
server/httplevel(orcompiled-indefault).