The problem is that alias
set doesn't ends with /
for directories. This results in incorrect paths created by index module (it will try to use something like /path/to/directoryindex.html
, and also affects how autoindex
works (when opening a directory it strips the last character in path, assuming it's /
). Trivial fix is to rewrite config to make sure directory paths from alias
ends with /
, like this:
location ~ ^/api/(?<module>.+/)doc/ {
autoindex on;
index index.html;
alias /home/dmac/www/hub/hub/modules/RestApi/Resources/Doc/$1;
error_log /var/log/nginx/hub-test-error.log debug;
}
Note well that correct behaviour happens automatically when using root
.