Index.php in folders

Is there a simple config I can use to check for an index.php in
subfolders?

It was my understanding that if I used

index index.php;

in the server block, and

try_files $uri $uri/ /index.php;

in location / {} that it would look for $uri/index.php. But I do seem to
be misunderstanding.

Help!

Steve


Steve H. BSc(Hons) MNZCS

Linkedin: http://www.linkedin.com/in/steveholdoway
Skype: sholdowa

Hello,

On Fri, Jun 7, 2013 at 1:24 AM, Steve H.
[email protected]wrote:

in location / {} that it would look for $uri/index.php. But I do seem to
be misunderstanding.


Your try_files directive is only working if your content is served by
the
location block where it is placed.
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.

I suggest you move the try_files directive up in the hierarchy, thus in
the
containing server block.

Help!


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.
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.

I suggest you use something like:
try_files $uri $uri/ /index.php =404;

Please read the documentation of the try_files
directivehttp://nginx.org/en/docs/http/ngx_http_core_module.html#try_filesfor
more information.​

B. R.