nginx 设置url访问文件只浏览不下载或者只下载不浏览
只浏览不下载location/{root/home/wwwroot/;indexindex.html;#新增配置
只浏览不下载
location / {
root /home/wwwroot/;
index index.html;
#新增配置
add_header Content-Type text/plain;
}
只下载不浏览
if ($request_filename ~* ^.*?\.(filename)$){
add_header Content-Disposition attachment;
}
nginx一般默认是下载
发表评论
评论列表
- 这篇文章还没有收到评论,赶紧来抢沙发吧~