【发布时间】:2015-03-25 19:27:56
【问题描述】:
当 nginx 服务一个带有自动索引的目录时,它会列出文件,但是当 index.html 存在时,浏览器会加载该文件。我希望它忽略它。
server {
listen 80;
server_name herbert;
location / {
root /srv/www;
index index.htm index.html;
add_header Cache-Control no-cache;
expires 300s;
}
location /site-dumps/ {
root /srv/www/;
autoindex on;
}
}
【问题讨论】:
-
你可以在
location中使用index nonexistent-file;。
标签: nginx mod-autoindex