<div dir="ltr"><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Hello,<br><br></div><div class="gmail_extra"><div class="gmail_quote">On Fri, Jun 7, 2013 at 1:24 AM, Steve Holdoway <span dir="ltr"><<a href="mailto:steve@greengecko.co.nz" target="_blank">steve@greengecko.co.nz</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Is there a simple config I can use to check for an index.php in<br>
subfolders?<br>
<br>
It was my understanding that if I used<br>
<br>
index index.php;<br>
<br>
in the server block, and<br>
<br>
try_files $uri $uri/ /index.php;<br>
<br>
in location / {} that it would look for $uri/index.php. But I do seem to<br>
be misunderstanding.<br></blockquote><div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline"><br>Your try_files directive is only working if your content is served by the location block where it is placed.<br>
<div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">If
another location block serves content, the try_files directive won't
apply. I don't know the default behavior then, but I guess that you
either need to specify a directory by ending the URI with a trailing
slash (directory) or specify the 'index.php' file at the end of it.<br><br></div>I suggest you move the try_files directive up in the hierarchy, thus in the containing server block.<br></div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Help!<br>
<span></span></blockquote><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)"><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">I
also suggest that you add something after the last part of the
try_files directive or replace it with a proper handler for missing
files.<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">In
your example, you specified that requests missing files should be
redirected to '/index.php'. That can end-up in a loop-hole if there is
no index.php file at root.<br><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">I suggest you use something like:<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">
try_files $uri $uri/ /index.php =404;<br><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Please read <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files" target="_blank">the documentation of the try_files directive</a> for more information.</div>
</div></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>