location ^~ /admin/ {
proxy_pass http://localhost:8000/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
deny all;
allow 192.168.111.0/24;
allow 172.16.0.0/24;
}
Но он из за этого постоянно редиректит на главную страницу сайта
proxy_pass http://localhost:8000;
location ^~ /admin/ {
proxy_pass http://localhost:8000/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
allow 192.168.111.0/24;
allow 172.16.0.0/24;
deny all;
}
location /admin {
auth_basic "closed site";
auth_basic_user_file conf/htpasswd;
}