Auth and PHP

David mishy.cth at
Sun Sep 7 17:19:39 MSD 2008


I am having a hard time trying to password protect a directory containing
PHP files.
Whenever I access I get a 404 error.
I have tried setting a fastcgi_param  SCRIPT_FILENAME in my forums/admin
location section and that doesn't work either. I have also been moving around
location sections incase there was a correct processing order that I
was missing out on but I couldn't get it to change anything.

Any help would be greatly appreciated.

This is my domain.conf

server {
        access_log      /var/log/nginx/ main;
        root    /home/user/public_html;
        index   index.php index.html index.htm;
        include /usr/local/nginx/fastcgi_params;

        location / {

        location ^~ /forums/admin {
                auth_basic            "Authorization Required";
                auth_basic_user_file  /home/user/not_web_accessible/.htpasswd;
                location ~ \.php$ {
                        fastcgi_intercept_errors  on;

        location ~ \.php$ {
                fastcgi_index index.php;
                fastcgi_intercept_errors  on;
                fastcgi_param  SCRIPT_FILENAME   

More information about the nginx mailing list