Firstly I’m a newbie on both mailing lists AND nginx so please be nice
to me

I use nginx as a reverse proxy and it works flawlessly.
But now I want to put basic authentication on certain ip addresses.
IE.
If I come from 10.0.0.0/24 network it should go through as usual.
But if I come from 10.100.0.0/24 it should have basic authentication.
Is there any way to accomplish this?
I use Apache as a backend webserver.
Br
Patric
PS English is NOT my native language so sorry for any misspellings…
I THINK you can define 2 server {} blocks and in each one define the IP
as the server_name or listen directive, it might work.
Hello!
On Thu, Jul 22, 2010 at 12:08:16PM +0200, Slask Sklask wrote:
Firstly I’m a newbie on both mailing lists AND nginx so please be nice to me

I use nginx as a reverse proxy and it works flawlessly.
But now I want to put basic authentication on certain ip addresses.
IE.
If I come from 10.0.0.0/24 network it should go through as usual.
But if I come from 10.100.0.0/24 it should have basic authentication.
Is there any way to accomplish this?
location / {
satisfy any;
allow 10.0.0.0/24;
deny all;
auth_basic "closed site";
auth_basic_user_file conf/htpasswd;
}
Most relevant link is:
http://wiki.nginx.org/NginxHttpCoreModule#satisfy_any
Directive “satisfy_any” was replaced by “satisfy” in 0.6.25.
Somebody have to fix wiki.
Maxim D.