nginx.conf:
location /download/ {
alias /root/web/download/;
add_header Content-disposition "attachment";
}
不加 ‘/’就是访问根目录,没有捕捉到 /download/ PATH
http://474.136.25.154/download
2020/08/18 15:13:31 [error] 12251#12251: *3065549 open() "/usr/local/openresty/nginx/html/download" failed (2: No such file or directory), client: 171.212.113.149, server: localhost, request: "GET /download HTTP/1.1", host: "47.106.185.114"
加 ‘/’就是访问PATH,捕获到 /download/ 判断条件
http://474.136.25.154/download/
2020/08/18 15:13:36 [error] 12251#12251: *3065549 directory index of "/root/web/download/" is forbidden, client: 171.212.113.149, server: localhost, request: "GET /download/ HTTP/1.1", host: "47.106.185.114"