参考地址:https://blog.csdn.net/u011519550/article/details/104419016
location ~ ^/download { if ($request_filename ~* ^.*?.(txt|doc|pdf)$){ add_header Content-Disposition: 'attachment'; add_header Content-Type application/octet-stream; } root F://doc; }
注意:root F://doc 目录的下一级一定是download