As I prepare to test some changes, I thought I'd set up a maintenance page block so I could do the testing.
Just realized though that the maintenance block examples for nginx take the site down for everyone.
How do you serve the maintenance page to visitors will still allowing localhost access.
Should I just create a new server block listening on another port and deny all, allow 127.0.0.1?
The way I do it is I have two copies of my site, one which is live and one which is development. I do a svn checkout to my development which and test it on there, and when changes are tested and ready I rsync them into my live environment.
Having a maintenance page because you're making changes really shouldn't be necessary unless you're making changes to for example a database where queries take several minutes to run.
But to answer your actual question, location blocks doesn't care about who is requesting the page, only about the URI. One work around would be to use the access module to deny access to anyone not you and then define the error page to be a maintenance page.
Instead of using the access module (like Martin Fjordvald suggested) which results in a
403 Forbidden
error you should consider returning a503 Service Temoporarily Unavailable
with a custom error page: