Welcome! Log In Create A New Profile

Advanced

Re: htpasswd protection prompts for index.php download

March 17, 2010 08:22PM
This is the expected behavior. I would guess that your configuration file contains a different location block for handling files with a ".php" extension. In this case nginx will only match one location. See http://wiki.nginx.org/NginxHttpCoreModule#location.

To avoid serving the index.php file as a text file you can try using nested location blocks. This is an undocumented feature and can have unpredictable results, but in this case I guess it will work OK.

Try something like:

[code]
location ~ /srv/www/users/me/(folder1|folder2)/.* {
auth_basic "Restricted";
auth_basic_user_file /srv/www/users/me/folder1/.htpasswd;
location ~\.php {
fastcgi_pass 127.0.0.1:9000; # substitute here with appropriate PHP backend address or proxy_pass statement and parameters.
...
}
}
[/code]

--
Jim Ohlstein
Subject Author Posted

htpasswd protection prompts for index.php download

ppnx March 17, 2010 08:01PM

Re: htpasswd protection prompts for index.php download

edogawaconan March 17, 2010 08:12PM

Re: htpasswd protection prompts for index.php download

Jim Ohlstein March 17, 2010 08:22PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 207
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