Nginx rewrite *.html to *.php

You'll need an if statement to check the file existance and rewrite appropriately:

location ~ \.html$ {
    if (!-f $request_filename) {
        rewrite ^(.*)\.html$ $1.php permanent;
    }
}