Answer the question
In order to leave comments, you need to log in
Nginx asks for authorization, again?
server {
listen *:80;
server_name site.local;
satisfy any;
allow 127.0.0.0/16;
allow 192.168.140.0/24;
allow 192.168.142.0/24;
allow 192.168.144.0/24;
auth_basic "site.local";
auth_basic_user_file /www/passw;
Answer the question
In order to leave comments, you need to log in
satisfy must be specified at the end, it is this command that will send everyone else to basic auth.
Working option:
server {
listen *:80;
server_name site.local;
auth_basic "site.local";
auth_basic_user_file /www/passw;
allow 127.0.0.0/16;
allow 192.168.140.0/24;
allow 192.168.142.0/24;
allow 192.168.144.0/24;
deny all;
satisfy any;
}
in order of delirium: try to add the implied deny all line; after your allowed list
Add deny all after the allow directives. And then in fact http_access does not work
So what is happening then? Are you sure that you are actually routed to site.local in such a way that Nginx sees the address from the above networks as source address?
My hands did not reach to figure out why the directives do not work. Today I guessed to look into the nginx log. The bottom line is that my site from an external network is accessible through a router. As a result, all requests for a domain name from the internal network do not go directly to the internal address, but are wrapped by the router on behalf of the external IP. Those. to make it work, you need to add the line allow EXTERNAL_IP. Here is such a banal solution, it was only necessary to turn on the head :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question