Why does this Nginx config result in "rewrite or internal redirection cycle"
The problem with your config is that if /index.html
cannot be found, it will redirect to /index.html
. Such configurations are better to avoid, even if you are sure that the file is here. A configuration like this don't have this problem:
root /opt/the-jam/www/dist/;
location / {
try_files $uri /index.html;
...
}
location = /index.html {
# no try_files here
...
}
With such configuration you also will be able to see what's wrong with /index.html
and why it can't be accessed. My best guess is that access rights on some intermediate directories doesn't allow nginx to access /opt/the-jam/www/dist/index.html
.