Struggling a little bit with this and I've looked around, but every time my server still always returns a 500 response.
Every page works find, and I can access the index.html by asking for it directly.
But going to the URL will return the 500, not the defined index
Currently, my config looks a little like this
root /var/www/html;
error_page 404 /404.html;
# Add index.php to the list if you are using PHP
index index.html;
location / {
try_files $uri $uri/ index.html =404;
}
I did try a variant with an index defined within the location block, but it didn't help.
I'm able to remove the issue entirely by moving the try_files instruction out of the location block and into the server one, but it doesn't exactly solve the issue with doing it this way and is going to bug me by not figuring it out.
The error.log printed
rewrite or internal redirection cycle while internally redirecting to "////////////"
Which is how I was able to find some help, but nothing decisive on my implementation
Mind posting your entire config and tell us a bit more about what you're hosting (pure html files/php etc)? The piece you posted works fine on one of my websites, I would suggest removing the index.html part of the try_files block as the $uri part already imports it from the index directive but I doubt that will actually solve anything.
http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files
What it seems like you're doing is using index to internally redirect to index.html, which is then redirected by try_files.
This should probably work
index index.html index.htm;
try_files $uri $uri/ =404;
Appears to have worked
Sorry, you need to Log In to post a reply to this thread.