Welcome! Log In Create A New Profile

Advanced

Re: Maintenance page and localhost access

Emil Krüper
May 28, 2010 02:46PM
Ian M. Evans wrote:
> As I prepare to test some changes related to the "0day exploit"
> thread, I thought I'd set up a maintenance page block so I could do
> the testing.
>
> Just realized though that the maintenance block examples 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?
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx
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 http://wiki.nginx.org/NginxHttpGeoModule

HTH, Emil Krüper

--
http://uruz.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Maintenance page and localhost access

Ian M. Evans May 21, 2010 07:38PM

Re: Maintenance page and localhost access

Mathew Davies May 27, 2010 04:00PM

Re: Maintenance page and localhost access

Emil Krüper May 28, 2010 02:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 178
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready