Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to switch some stuff over to a domain running nginx. Is there a simple way to just put my ip address in the configuration for the subdomain and say "If ip is not mine, then just serve this html file. Otherwise, act like normal"?

share|improve this question
up vote 2 down vote accepted

You can tackle this by using IP based maintenance triggers

Try the following at the bottom of here:,88978,91161

You could just do it like this in the global section:

geo $maintenance { default 0;
80.15x.yy.zz/29 0; # your IPs still allowed
80.15x.yy.zz/29 0; # another bunch of allowed IPs }

and in the server section add this:

if ($maintenance) { rewrite ^(.*)$
/yourmaintenancefile.html last; }

When you want to start maintenance just switch the "default 0;" to "default 1;" in the $maintenance block and reload your nginx.

Have a look at

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.