try_files question... or alternative?

Francis Daly francis at daoine.org
Mon Jun 17 22:27:12 UTC 2013


On Tue, Jun 18, 2013 at 10:05:07AM +1200, Steve Holdoway wrote:

Hi there,

> Is there a simple way of getting nginx to search for the index when
> given a bare directory as URL?

In general, this is a bad idea. In your specific case, it may not be.

So if an explicit listing is acceptable, then you could try something
like

  location / {
    try_files $uri $uri/index.php $uri/index.html $uri/ =404;
  }

with whatever surrounding extra configuration is needed.

But really, /sub and /sub/ are different urls, and you should have a good
reason to not just use the defaults.

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list