Nginx: autoinagedex不起作用

大家好,我按照指南
https://www.youtube.com/watch?v=7QXnk8emzOU
并做了一切都同样的事情,我检查了其他类似的问题,如
https://serverfault.com/questi ... -work

https://serverfault.com/questi ... index
.

配置文件 nginx:

server {
listen 80; #says to listen on standard port
server_name _; #the default server
location / { #location is the root of the site
root /test/a/; #root is located at /test/a/
index index.htm; #index is for autocomplete
autoindex on; #this way files will be autoindexed
}
}

文件 html 位于地址

/test/a

, 一

/test/a/index.htm

, 其他

/test/a/outdex.htm

. 我看到了内容 index.htm, 连接到服务器的IP地址时。

我依次更改了整个内容的权限,以避免先前权限的问题,如:


chmod 777 -R /test
已邀请:

江南孤鹜

赞同来自:

经过一些错误和样本,我找到了一个解决方案。 我的问题实际上是微不足道的。 字符串开始

index

指定将用作索引的文件,因为我刚刚放置一个文件,而不是目录,它是我在更改索引后唯一得到的东西,如下所示,我得到了我的预期。

server {
listen 80; #says to listen on standard port
server_name _; #the default server
location / { #location is the root of the site
root /test/a/; #root is located at /test/a/
index test; #index is for autocomplete
autoindex on; #this way files will be autoindexed
}
}

来源:

http://nginx.org/en/docs/http/ ... .html
https://www.youtube.com/watch?v=7QXnk8emzOU

要回复问题请先登录注册