Answer the question
In order to leave comments, you need to log in
How to write a rule in nginx for certain URLs to start at a certain ip address, and if the ip address is different, then request authorization by login password?
How to write a rule in nginx for certain URLs to start at a certain ip address, and if the ip address is different, then request authorization by login password?
Answer the question
In order to leave comments, you need to log in
IP address restrictions: nginx.org/ru/docs/http/ngx_http_access_module.html Login
and password authentication: nginx.org/ru/docs/http/ngx_http_auth_basic_module.html
Or using an additional request (for example, to the backend): nginx.org/ru/docs/http/ngx_http_auth_request_modul...
For all this to work as you need, just add to the appropriate context:
server {
location / {
proxy_pass http://backend;
}
location /private {
allow 192.168.0.0/24;
deny all
auth_basic "Private zone";
auth_basic_user_file htpasswd;
satisfy any;
proxy_pass http://backend/private;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question