我需要在本地配置一个文件下载服务,打算用Nginx实现,配置如下:
server {
listen 10015;
server_name localhost 127.0.0.1;
access_log logs/host.access.log main;
location = /download {
root C:/download/;
autoindex on;
autoindex_exact_size off;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET;
}
}
但当我请求http://127.0.0.1:10015/download/
2021/10/08 12:03:46 [error] 16328#13120: *18 "C:\DevTools\nginx-1.20.1/html/download/index.html" is not found (3: The system cannot find the path specified), client: 127.0.0.1, server: localhost, request: "GET /download/ HTTP/1.1", host: "127.0.0.1:10015"
请求总是指向C:\DevTools\nginx-1.20.1/html/download而不是C:/download/,看起来配置文件location的root配置没有起作用,请问如何解决,谢谢!