nginx,apache web服务器支持POST动态下载文件
来源:互联网 发布:matlab解符号矩阵方程 编辑:程序博客网 时间:2024/05/05 01:10
1.后端动态脚本处理下载;
<?phpob_end_clean();header('Content-Type: audio/mpeg');$filename=$_GET['r'];$file='/data/www/down/'.$filename;$filename=$filename?$filename:'R_ACC_LOCATION_ALL.bin';header('Content-Disposition: attachment; filename='.$filename );header('Content-Length: ' . filesize($file));$fp = fopen($file, 'rb');fpassthru($fp); //此处需要php去磁盘读文件然后传给web服务器,最后在传给客户端,也可以直接用 X-Sendfile 下载文件提高性能fclose($fp);//参考 http://blog.csdn.net/czh1986/article/details/8482384
2. nginx 服务器伪静态设置
location / { if (!-e $request_filename) { rewrite ^/down/(.*)$ /down.php?r=$1 last; } }
3. apache 服务器配置
a. 打开rewirte 模块。
b. 然后在站点目录下面新建 .htaccess 文件
内容如下:
<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^down/(.*)$ down.php?r=$1 [QSA,PT,L]</IfModule>
4. 最终的POST 地址为 http://www.test.com/down/down-test.txt
- nginx,apache web服务器支持POST动态下载文件
- 让服务器apache/iis/nginx支持.apk/ipa文件下载
- 树莓派做web服务器(nginx、Apache)
- Apache(Web服务器)和Nginx
- 树莓派做web服务器(nginx、Apache)
- 树莓派做(nginx、Apache)web服务器
- ubuntu apache 服务器 文件下载
- 怎么才能使服务器Nginx(或者Apache)支持字体文件
- Nginx胜过Apache十倍的Web服务器
- WEB服务器对比分析(apache,lighttpd,nginx)
- WEB(nginx、apache)服务器配置mod_ssl
- Web服务器- apache与nginx分析
- 三大WEB服务器apache,nginx,lighttpd
- web服务器该选择apache还是nginx
- WEB服务器如何选择 Apache or Nginx?
- WEB服务器如何选择 Apache or Nginx?
- 作为web服务器,nginx和apache对比
- WEB服务器如何选择 Apache or Nginx?
- Qt 5.1.1 中找不到'GLES2/gl2.h'文件的解决办法。
- Qt+VS2012+Win8 64Bit安装
- dreamweaver 注意01
- 二分法实现插入排序,时间复杂度O(nlgn),算法导论练习2.3,linux纯C实现
- 矢量图与位图
- nginx,apache web服务器支持POST动态下载文件
- Simple Template
- 信号掩码——The signal mask
- android改变应用程序图标的方法
- 关于网页中的警框与
- sql
- 看似落后的UI设计来源----报纸
- DiabloFX展示模板 joomla多用途二手房公司企业博客商业主题
- 奖学金 qsort函数多重排序