1、配置对应的server
server { listen 80; server_name localhost; charset utf-8; # 文件下载location / { default_type 'application/octet-stream'; add_header Content-disposition "attachment"; root /home/cookie; #文件存放路径 ,该文件夹需要有读写权限 } }
2、为对应文件夹授权
chmod 777 /home/cookie
3、在浏览器属于对应地址下载该目录下的文件
http://47.xx.xx.73/1.txt
![540905137dc3ce455825fda8e6c18ddc.png](https://i-blog.csdnimg.cn/blog_migrate/fbe9b69b6c6334a6a73ab9bda689dc9b.jpeg)
location /apple-app-site-association { add_header Content-Type "application/octet-stream"; add_header Content-Disposition "attachment; filename=$1"; root /home/newrank/run/data/genus/h5WeixinAccessKey; } location ~* .(apk)$ { default_type application/vnd.android.package-archive; root /home/newrank/run/data/genus/h5WeixinAccessKey; }