S
S
sBec2013-12-27 16:06:06
PHP
sBec, 2013-12-27 16:06:06

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

2 answer(s)
S
Sergey Sokolov, 2013-12-27
@sergiks

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;
  }
}

S
sBec, 2013-12-27
@sBec

Files and directories are closed, but the pages that are generated by php are not :(

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question