Welcome! Log In Create A New Profile

Advanced

Re: HT Auth Problem

merlin corey
June 08, 2009 06:16AM
The problem is clear and you have no need of nested locations (though
that is one possible solution and hints at the issue). Observe:

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/var/www/tributes-direct.co.uk/$fastcgi_script_name;
include fastcgi_params;
}

This regular expression indeed covers all PHP files. There is no auth
here, so it does not ask for auth, only for the resources that ARE
under a location with auth. You can try a nested location, or you can
add a second more specific php handling location block that also has
auth in it, or you can make an internal location for PHP and pass back
to it for the regular expressions. The middle method is most
straightforward (and not demonstrated yet) and might be implemented
like so:

location ~ ^/protectedstuff/.*\.php$ {
auth_basic "Enter Credentials";
auth_basic_user_file /path/to/auth;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/var/www/tributes-direct.co.uk/$fastcgi_script_name;
include fastcgi_params;
}




On Sat, Jun 6, 2009 at 6:09 AM, matt91<nginx-forum@nginx.us> wrote:
> I am having a problem with HT Auth where it will protect the directory and all files in it except the php files, I think this is a problem with nginx passing all php files for processing by fcgi before the authentication. For example mysite.com/imnottelling/ and mysite.com/imnottelling/hello.html is protected however mysite.com/imnottelling/anything.php is not. Here is my virtual host config file for the domain:
>
> server {
>
Subject Author Posted

HT Auth Problem

matt91 June 06, 2009 09:09AM

Re: HT Auth Problem

matt91 June 06, 2009 11:16AM

Re: HT Auth Problem

Rob Schultz June 06, 2009 11:50AM

Re: HT Auth Problem

merlin corey June 08, 2009 06:16AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 314
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready