Nginx and site maintenance

I want to do some maintenance to a VPS site running under nginx. Assuming that

  • my IP address will be
  • I have created/placed the file /error503.html

Will the following additions to my nginx file block all users but me?

if ($remote_addr != "") {
    return 503;

error_page 503 @maintenance;

location @maintenance {
    rewrite ^(.*)$ /error503.html break;


I’m not sure of the syntax for nginx, but I use something almost exactly the same in PHP and it does exactly what you want it to do.