<div>On 26 May 2011 00:57, phil1886 <span dir="ltr">&lt;<a href="mailto:nginx-forum@nginx.us">nginx-forum@nginx.us</a>&gt;</span> wrote:</div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi everyone<br><br></blockquote><div><br></div><div>Hi.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
                location /newwebsite/admin {<br>
                        index login.php;<br>
                        auth_basic              &quot;Unauthorised use<br>
prohibited&quot;;<br>
                        auth_basic_user_file<br>
/home/username/<a href="http://www.website.com/.htpasswd" target="_blank">www.website.com/.htpasswd</a>;<br>
<br>
                }<br>
<br>
Of course I have the catch-all for all the php scripts:<br>
<br>
                location ~ \.php$ {<br>
                        include /etc/nginx/fastcgi_params;<br>
                        fastcgi_pass    <a href="http://127.0.0.1:9000" target="_blank">127.0.0.1:9000</a>;<br>
                        fastcgi_index   index.php;<br>
                        fastcgi_param   SCRIPT_FILENAME<br>
$document_root$fastcgi_script_name;<br>
                        fastcgi_param   PATH_INFO<br>
$fastcgi_script_name;<br>
                }<br>
<br><br>
When I visit <a href="http://domain.com/newsite/admin/admin.php" target="_blank">http://domain.com/newsite/admin/admin.php</a> I am straight in<br>
without http basic-auth. This is not so good..!!<br><br></blockquote><div><br></div><div><br></div><div><br></div><div>You have to put a copy of the ~ \.php$ location block inside the protected location block (nested), otherwise the php block takes precedence and the location parser does not match anything else. <div>
<br></div><div>I had exactly the same problem: <a href="http://forum.nginx.org/read.php?2,189220">http://forum.nginx.org/read.php?2,189220</a></div><div><br></div><div>Thomas</div><div><br></div></div><div> </div></div></div>