我正在尝试设置 nginx,以便某个 url 在我的服务器上生成某个目录的目录索引。目前这是我的 default.conf 的样子。
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /files/ {
root /home/myfiles/Downloads;
autoindex on;
}
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试访问 mysite.com/files/ 或 mysite.com/files 时,出现 403 Forbidden 错误。
查看我看到的错误日志
2012/01/08 16:23:18 [error] 17619#0: *1 "/home/myfiles/Downloads/files/index.html" is forbidden (13: Permission denied), client: some.ip.addr.ess, server: _, request: "GET /files/ HTTP/1.1",
Run Code Online (Sandbox Code Playgroud)
我不希望它搜索 files/index.html,我只想要下载的目录索引。我需要改变什么才能使事情以这种方式工作?