I have the following server configuration:
server {
listen 80;
server_name _;
root /var/www/;
location /calendars/ {
autoindex on;
try_files $uri.ics $uri =404;
}
}
If would expect to get the autoindex
page on visiting http://example.com/calendars/
, however I get an 404 File not found
error instead.
I want the server do something like this pseudo-code:
if($uri is directory) {
if(one of index pages exists in directory) {
show index page;
} else {
show autoindex page;
}
} else {
if($uri.ics exists) {
show $uri.ics;
} else if($uri exists) {
show $uri;
} else {
show 404 page;
}
}