Protect a specific php file

António P. P. Almeida appa at
Thu Jan 12 16:52:34 UTC 2012

On 12 Jan 2012 16h21 WET, nginx-forum at wrote:

> Hello, 
> Any idea why ? Any solution ?

Yes. Duplicate the FCGI setup in the /myapp/index.php location.

                location ^~ /myapp/index.php {
                    auth_basic "Private Section";
                    auth_basic_user_file  $document_root/.htpasswd;
                    include /etc/nginx/fastcgi_params;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

--- appa

More information about the nginx mailing list