I am trying to use capistrano-maintenance gem and here is an example for nginx config to set mainenance page:
capistrano-maintenance
error_page 503 @503; # Return a 50