I retested again this morning and it is working correctly. I assumed my browser cached the request and gave me false results.<br><br>Thank you Marcus, Michal and Igor for your help.<br><br><div class="gmail_quote">2009/10/28 Igor Sysoev <span dir="ltr"><<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">On Wed, Oct 28, 2009 at 01:37:04AM +0000, Mathew Davies wrote:<br>
<br>
> ><br>
> > A more efficient way of doing this is :<br>
> ><br>
><br>
> I do not see why. I am specifying "return 403" 3 times vs once. I was it<br>
> doing it this way before and did not think it was so efficient.<br>
><br>
> Here is my full config<br>
><br>
> server {<br>
> > Â Â Â Â listen 80;<br>
> > Â Â Â Â server_name ---;<br>
> > Â Â Â Â root /home/website/www/---/public/;<br>
> > Â Â Â Â index index.php index.html index.htm;<br>
> ><br>
> > Â Â Â Â # Logs<br>
> > Â Â Â Â access_log /home/website/www/---/log/access.log combined;<br>
> > Â Â Â Â error_log /home/website/www/---/log/error.log warn;<br>
> ><br>
> > Â Â Â Â # Protect certain directories.<br>
> > Â Â Â Â location ~* ^/(library|conf|appg) {<br>
> > Â Â Â Â Â Â Â Â return 403;<br>
> > Â Â Â Â }<br>
> ><br>
> > Â Â Â Â # Cache forum assets for as long as possible.<br>
> > Â Â Â Â location ~* \.(css|js|gif|ico)$ {<br>
> > Â Â Â Â Â Â Â Â expires max;<br>
> > Â Â Â Â Â Â Â Â add_header Cache-Control private;<br>
> > Â Â Â Â Â Â Â Â break;<br>
> > Â Â Â Â }<br>
> ><br>
> > Â Â Â Â location ~* \.php$ {<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>
> > Â Â Â Â Â Â Â Â include fastcgi_params;<br>
> > Â Â Â Â }<br>
> > }<br>
> ><br>
<br>
</div></div>In this configuration <a href="http://domain.com/appg/.file" target="_blank">http://domain.com/appg/.file</a> should be handled by<br>
    location ~* ^/(library|conf|appg) {<br>
Could you create debug of the request ?<br>
<div><div></div><div class="h5"><br>
> Thank you for the quick response.<br>
><br>
> 2009/10/28 Marcus Clyne <<a href="mailto:maccaday@gmail.com">maccaday@gmail.com</a>><br>
><br>
> > Mathew Davies wrote:<br>
> ><br>
> >> Hi.<br>
> >><br>
> >> I am having trouble with a location regular expression.<br>
> >><br>
> >> Â Â location ~* ^/(library|conf|appg) {<br>
> >> Â Â Â return 403;<br>
> >> Â Â }<br>
> >><br>
> >> Â A more efficient way of doing this is :<br>
> ><br>
> > location ^~ /library {<br>
> >  return  403;<br>
> > }<br>
> ><br>
> > location ^~ /conf {<br>
> >  return  403;<br>
> > }<br>
> ><br>
> > location ^~ /appg {<br>
> >  return  403;<br>
> > }<br>
> ><br>
> > since it checks the URLs using string comparison (rather than regexes) and<br>
> > will halt location-searching immediately if it matches one of the above<br>
> > locations.<br>
> ><br>
> ><br>
> ><br>
> ><br>
> >> It is my understanding the following regular expression should match any<br>
> >> uri starting with library, conf or appg. However, this is not the case.<br>
> >><br>
> >> For instance.<br>
> >><br>
> >> Â Â <a href="http://domain.com/appg/" target="_blank">http://domain.com/appg/</a><br>
> >><br>
> >><br>
> >> will match fine where as<br>
> >><br>
> >> Â Â <a href="http://domain.com/appg/.file" target="_blank">http://domain.com/appg/.file</a><br>
> >><br>
> >><br>
> >> wont match (causing the file to be downloaded)<br>
> >><br>
> >> Am I doing something inherently wrong or is this a bug in Nginx?<br>
> >><br>
> > There's probably some other location directive in your conf that is<br>
> > matching <a href="http://domain.com/appg/.file" target="_blank">http://domain.com/appg/.file</a>. Â If you don't want to use the more<br>
> > efficient, static locations above, try posting your full conf file.<br>
> ><br>
> > Marcus.<br>
> ><br>
> ><br>
<br>
</div></div><div><div></div><div class="h5">--<br>
Igor Sysoev<br>
<a href="http://sysoev.ru/en/" target="_blank">http://sysoev.ru/en/</a><br>
<br>
</div></div></blockquote></div><br>