Answer the question
In order to leave comments, you need to log in
How to close a specific url with a password, but through base_auth?
Good afternoon. Need help. You need to close a certain url with a password, but through base_auth you can only close the directory (which exists). I looked all over Google and Yandex, but did not find the answer.
Tried to close like this:
location ^~ /test/ {
auth_basic "admin login";
auth_basic_user_file /etc/nginx/httpd.passwd;
location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass our-socket;
}
}
Thanks.
Answer the question
In order to leave comments, you need to log in
I have eg. this is how closing a single file works:
location ~/some_folder/secret.php$ {
auth_basic "Secret area";
auth_basic_user_file /home/users/.htpasswd;
location ~* \.php {
include /etc/nginx/fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_index index.php;
fastcgi_pass php;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question