trouble with static content (Revised)

deeztek nginx-forum at forum.nginx.org
Sun Nov 7 13:46:17 UTC 2021


Hi,

So when I say static content, I mean resources such as .css, .js .png, .jpg
etc.

so, with the following in place:

location ~* .(?:ico|css|js|gif|jpe?g|png|woff2|map)$ {
expires max;
}

Requests to the / location, I get 404s:

GET https://host.domain.tld/static/js/vendor.d0bc79df.js net::ERR_ABORTED
404 (Not Found)
GET https://host.domain.tld/static/css/index.393eb37d.css net::ERR_ABORTED
404 (Not Found)

However requests to the /admin location all work. Also I forgot to add that
the following:

root /var/www/html;

must also be present the server block before the /admin location works,
which I think is odd because I have the:

 root /var/www/html/;

in the /admin location.

Anyways, if I remove the following:

location ~* .(?:ico|css|js|gif|jpe?g|png|woff2|map)$ {
expires max;
}

Requests to the /admin location, I get 404s:

GET https://192.168.10.145/admin/fusion.css net::ERR_ABORTED 404
GET https://host.domain.tld/:142 GET https://192.168.10.145/admin/style.css
net::ERR_ABORTED 404
GET https://host.domain.tld//:143 GET https://192.168.10.145/admin/site.css
net::ERR_ABORTED 404
GET https://host.domain.tld//:232 GET
https://192.168.10.145/admin/hermes_seg_menu2.js net::ERR_ABORTED 404
GET https://host.domain.tld//:349 GET https://192.168.10.145/admin/help.png
404
GET https://host.domain.tld//:232 GET
https://192.168.10.145/admin/hermes_seg_menu2.js net::ERR_ABORTED 404

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,292760,292762#msg-292762



More information about the nginx mailing list