This worked for me. This is assuming you only have a index.html,htm and the other urls are missing the physical file on disk.
server {
listen 80;
server_name www.example.com example.com;
root /u/apps/example/www;
index index.html;
location / {
if (!-e $request_filename) {
rewrite ^ / permanent;
}
}
}