【apache tomcat 配置】ngixn与apache配置apk/ipa/exe/txt点击实现下载

更新时间:2018-10-03    来源:apache    手机版     字体:

【www.bbyears.com--apache】

apache网上的解决方法是:

 代码如下


  ForceType application/octet-stream
  Header set Content-Disposition attachment

但启动apache失败,找了些资料发现是因为apache需要加载一个header so文件:

LoadModule headers_module modules/mod_headers.so

否则无法使用Header set ,不过去掉 Header set Content-Disposition attachment 这一句重启apache,

清空浏览器缓存后也可以实现强制下载。

nginx,在网上没找到现成的方法,在nginx的文档中找到解决方法:

 代码如下

location /download/ {
    types {        application/octet-stream txt;
        application/octet-stream exe;
        application/octet-stream ipa apk;
    }...
}

这样在解析到types中的后缀文件就会将contenttype 设置为application/octet-stream 提供下载。

本文来源:http://www.bbyears.com/jiaocheng/44787.html

热门标签

更多>>

本类排行