I\'ve seen a few ways to rewrite the $request_uri and add the index.html to it when that particular file exists in the file system, like so:
For the root /index.html, the answer from Nicolas resulted in a redirect loop, so I had to search for other answers.
This question was asked on the nginx forums and the answer there worked better. http://forum.nginx.org/read.php?2,217899,217915
Use either
location = / {
try_files /index.html =404;
}
location = /index.html {
internal;
error_page 404 =301 $scheme://domain.com/;
}
or
location = / {
index index.html;
}
location = /index.html {
internal;
error_page 404 =301 $scheme://domain.com/;
}