nginx.conf jest następujący:Nginx: Kiedy `index` i` try_files` w tym samym bloku, dlaczego `try_files` będzie przetwarzane, a nie dyrektywa` index`?
http {
server {
listen 8080;
server_name example.com;
root /tmp/test/example;
location/{
index index.html;
try_files $uri /test.html;
}
}
}
Kiedy dostęp example.com:8080
, to uzyskuje dostęp do /tmp/test/example/test.html
, nie index.html
.
Co powiesz na "try_files $ uri $ uri//test.html;'? –
@RichardSmith, uzyskał dostęp do pliku 'index.html', dlaczego? – zhenguoli