trouble with static content (Revised)

deeztek nginx-forum at forum.nginx.org
Sun Nov 7 16:00:39 UTC 2021


>The config above says that nginx should serve something like the file
>/usr/local/nginx/html/static/js/vendor.d0bc79df.js in response to the
>first request. The actual response is a 404. Does that file exist?

The specific /static/js/vendor.d0bc79df.js files does not exist in
/usr/local/nginx/html directory. It's served by the service
http://127.0.0.1:9091 and I don't know exactly the path in that service. All
I can see is the /static/js/vendor.d0bc79df.js request.

To expand further, the /static/js/vendor.d0bc79df.js works when I remove the
following from the config:

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

To give you a bit of background. The /admin location is served by Lucee/CFML
server running on Tomcat on port 8888. Everything I read says to include the
following location in order for Nginx to serve .ico, .css. js etc files:


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


Please see here:
http://dnando.github.io/blog/2015/01/05/advantages-of-nginx/

So, when I include the location ~* the application that lives on port 8888
works fine, HOWEVER, the application that lives on 9091 breaks. If I
remove:


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

Then, the application that lives on port 9091 works but the application on
port 8888 breaks.

So, the way I'm figuring, I need a way to specify a /admin specific location
for static files (.ico, .css, .js etc) since they are not being served by
Nginx unless I have a specific directive for those type of files for the
application in the /admin location.

Hope that makes more sense.

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



More information about the nginx mailing list