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:
This is working for me:
rewrite ^(|/(.*))/index\.html$ /$2 permanent;
It covers both the root instance /index.html and lower instances /bar/index.html
The first part of the regex basically translates as: [nothing] or /[something] - in the first case $2 is an empty string so you redirect to just /, in the second case $2 is [something] so you redirect to /[something]
I actually went a bit fancier to cover index.html, index.htm, and index.php
rewrite ^(|/(.*))/index\.(html?|php)$ /$2 permanent;