location not working

Francis Daly francis at daoine.org
Fri Apr 9 06:55:09 UTC 2021


On Thu, Apr 08, 2021 at 04:36:47PM -0400, uragnorson wrote:

Hi there,

> location / {
> root /usr/share/nginx.html;
> }
> 
> location /dist/ { 
> alias /usr/share/nginx/html/dist/;
> }

Because, in this case, the "location" part matches the end of the "alias"
part, you could instead choose to use "root" here as well.

http://nginx.org/r/alias

> I am able to navigate to http://server/dist but in dist the index.html is
> looking for http://server/js but it should be http:/server/dist/js is there
> a way to add the extra "dist" ?

The easiest way would be to change the index.html.

If it refers to http://server/js or to /js, make it instead refer to js.

Failing that, you could try setting up extra location{}s or redirects
to handle this one exception; but I imagine that will turn in to "just
one more exception as well...", multiple times.

Cheers,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list