A maintenance page that was actually served

A maintenance page that requires the application to be running is not a maintenance page.

location / {
    if (-f /srv/app/shared/maintenance.html) {
        return 503;
    }
    try_files $uri /index.php$is_args$args;
}

error_page 503 @maintenance;
location @maintenance {
    root /srv/app/shared;
    rewrite ^ /maintenance.html break;
    add_header Retry-After 300 always;
}

Serving it from the web server means it works when PHP is stopped, the database is down or the deploy is halfway through — which is when it is needed. The 503 status is the part that gets missed: returning 200 with a maintenance page tells search engines the page is the content. Retry-After is a courtesy that well-behaved clients honour.