<div dir="ltr"><div><div><div><div><font color="#333399"><font>Hello,<br><br></font></font></div><font color="#333399"><font><font>I am using the auth_basic directive to restrict access to a whole ser<font>ver (auth_basic server-wide set, not in any particular location).<br>

</font></font></font></font></div><font color="#333399"><font><font><font><font>Since I </font>am using php, I am also usi<font>ng:<br><br></font></font></font></font></font></div><font color="#333399"><font><font><font><font><font>location ~ \.php$ {<br>

</font></font></font></font></font></font></div><font color="#333399"><font><font><font><font><font><font>    FastC<font>GI</font> stuff</font> here...<br></font></font></font></font></font></font><div><font color="#333399"><font><font><font><font><font><font>}</font><br>

<br></font></font></font></font></font></font></div><div><font color="#333399"><font><font><font><font><font><font>to forward</font> my request to the PHP application.<br><br></font></font></font></font></font></font></div>

<div><font color="#333399"><font><font><font><font><font><font>Now, I would like to re<font>move the auth_basic authentication for a very unique and specific locatio<font>n: <font>thisfile.php<br><br></font></font></font></font></font></font></font></font></font></font></div>

<div><font color="#333399"><font><font><font><font><font><font><font><font><font><font>I first tried</font>:<br></font></font></font></font></font></font></font></font></font></font><br clear="all"><font color="#333399"><font><font><font><font><font>location ~ \.php$ {<br>

</font></font></font></font></font></font></div><div><font color="#333399"><font><font><font><font><font><font>    location = /thisfile.php {<br></font></font></font></font></font></font></font></div><div><font color="#333399"><font><font><font><font><font><font><font>        auth_basic off;<br>

</font></font></font></font></font></font></font></font></div><div><font color="#333399"><font><font><font><font><font><font><font><font>    }</font><br></font></font></font></font></font></font></font></font></div><div>
<font color="#333399"><font><font><font><font><font><font>    FastC<font>GI</font> stuff</font> here...<br>
</font></font></font></font></font></font><font color="#333399"><font><font><font><font><font><font>}</font><br><br></font></font></font></font></font></font></div><div><font color="#333399"><font><font><font><font><font><font>but Nginx said<font>:<br>

nginx: [emerg] location "/thisfile.php" is outside location "\.php$" in .../nginx/conf.d/<font>mystupid</font>.conf:6<font>9</font><br>nginx: configuration file .../nginx/nginx.conf test failed</font></font><br>

<br></font></font></font></font></font></font></div><div><font color="#333399"><font><font><font><font><font><font>I then tried:<br></font></font></font></font></font></font></font><br><font color="#333399"><font><font><font><font><font><font><font color="#333399"><font><font><font><font><font>location ~ \.php$ {<br>

</font></font></font></font></font></font></font></font></font></font></font></font></font><div><font color="#333399"><font><font><font><font><font><font>    location ~ ^/thisfile.php$ {<br></font></font></font></font></font></font></font></div>

<div><font color="#333399"><font><font><font><font><font><font><font>        auth_basic off;<br></font></font></font></font></font></font></font></font></div><div><font color="#333399"><font><font><font><font><font><font><font><font>    }</font><br>

</font></font></font></font></font></font></font></font></div><div><font color="#333399"><font><font><font><font><font><font>    FastC<font>GI</font> stuff</font> here...<br></font></font></font></font></font></font><font color="#333399"><font><font><font><font><font><font>}</font><br>

<br></font></font></font></font></font></font></div><font color="#333399"><font><font><font><font><font><font>But of course now the Fast<font>CGI part does not server the request and the PHP file is sent for download...</font><br>

<br></font></font></font></font></font></font></font></div><div><font color="#333399"><font><font><font><font><font><font><font>What king of clean solution do I have?<br></font></font></font></font></font></font></font></font></div>

<div><font color="#333399"><font><font><font><font><font><font><font><font>Am I forced to place the auth_basic in <font>all my <font>'location' blocks but one, which would be for 'thisfile.php<font>'?<br>
<br>
</font></font></font></font></font></font></font></font></font></font></font></font></div><div><font color="#333399"><font><font><font><font><font><font><font><font><font><font><font><font>Thanks,</font></font></font></font></font></font></font></font></font></font></font></font></font><br clear="all">

<div><font size="1"><span style="color:rgb(102,102,102)">---<br></span><b><span style="color:rgb(102,102,102)">B. R.</span></b><span style="color:rgb(102,102,102)"></span></font></div>
</div></div>