Is there a simple way of getting nginx to search for the index when
given a bare directory as URL?
eg in a server block…
index index.php index.html index.htm;
when passed an URL of http://www.example.com/sub where there is no
location /sub {} block
it looks for http://www.example.com/sub/index.php etc…
Cheers,
Steve
–
Steve H. BSc(Hons) MNZCS
Linkedin: http://www.linkedin.com/in/steveholdoway
Skype: sholdowa
On Tue, Jun 18, 2013 at 10:05:07AM +1200, Steve H. 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 D. [email protected]