From 3a146d7dfb77494b69636e5490ef523d1b69c3ad Mon Sep 17 00:00:00 2001 From: shenlan Date: Fri, 19 Sep 2025 20:49:51 +0800 Subject: [PATCH] Fix autoindex template logic --- playbooks/roles/vhosts/OpenResty/templates/artifact.conf.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/vhosts/OpenResty/templates/artifact.conf.j2 b/playbooks/roles/vhosts/OpenResty/templates/artifact.conf.j2 index 02f5459..3fe901b 100644 --- a/playbooks/roles/vhosts/OpenResty/templates/artifact.conf.j2 +++ b/playbooks/roles/vhosts/OpenResty/templates/artifact.conf.j2 @@ -24,15 +24,15 @@ server { add_header Accept-Ranges bytes; try_files $uri $uri/ =404; # 保持原有 404 语义 } - {% elif %} + {% elif autoindex_paths %} {% for path in autoindex_paths %} location {{ path }} { autoindex on; autoindex_exact_size off; autoindex_localtime on; } - {% endif %} - {% endfor %} + {% endfor %} + {% endif %} # 常见安装包直下读文件(大小写不敏感) # 这里无需 try_files,命中即直接读文件;减少一次磁盘判断