I'm trying to use NGINX to route requests with no path (e.g. http://example.com/ or http://example.com) to a particular html file using this config (this is just the relevant section in the server config):
root $root;
location = / {
index index.html;
alias $root/apps/www/html/main/;
}
If I navigate to the site with just the root url (http://example.com) I would expect NGINX to return <root>/apps/www/html/main/index.html but instead it ignores the exact location and goes directly to the root: all requests come back with the error that <root>/index.html cannot be found.
To try to debug this I've tried using different exact location paths (e.g. location = /foo) but those are ignored as well. Also I've tried using root instead of alias, but no success there either.
How do you reroute to a specific location in NGINX?