nginx文件下载,需要显示文件名完整名称

 location /download {
            alias  /download;
            if ($request_uri ~* ^.*\/(.*)\.(docx|DOCX|pptx|PPTX|xlsx|XLSX|doc|DOC|ppt|PPT|xls|XLS|wps|et|dps|jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF|bmp|BMP|emf|EMF|wmf|WMF|tif|TIF|tiff|TIFF|wdp|WDP|jpe|JPE|zip|ZIP)(\?n=([^&]+))$) { 
                add_header Content-Disposition "attachment;filename=$arg_n";

}
            #autoindex on;
        }

猜你喜欢

转载自blog.csdn.net/licanfeng1/article/details/135946758