• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

Question Nginx behaving strangely with auth_basic

Dirk

Basic Pleskian
I have the following line in nginx. conf:
location ^~ /internal/ {auth_basic "Restricted"; auth_basic_user_file /var/www/. htpasswd; }

This works well, but the following problem occurs. If I'm in the internal area and now access a php file in the directory, it won't be executed but downloaded. As soon as I comment out the above line, everything works fine again.
Now, if I skip the ^ so that the line looks like this:
location ~ /internal/ {auth_basic "Restricted"; auth_basic_user_file /var/www/. htpasswd; }
Then the php will be executed again, but you can now access individual files directly in the protected directory - so you can't access www.domain.de/internal without password, but you can access www.domain.de/internal/bild1.jpg

Does anyone have an idea how I can protect the entire directory and its contents and still the php runs normally?
 
Back
Top