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"

相关文章:

  • 2022-12-23
  • 2021-07-12
  • 2021-05-02
  • 2021-05-25
  • 2021-11-28
  • 2021-10-28
猜你喜欢
  • 2021-09-28
  • 2022-12-23
  • 2021-10-26
  • 2021-11-27
  • 2021-12-26
  • 2021-07-01
相关资源
相似解决方案