我现在有2点图像的位置和他们可能的格式(JPG,JPEG,PNG,GIF)如何强制浏览器下载文件,nginx的服务器
i.domain.com/simage.jpg thumbnail
i.domain.com/image.jpg high quality
i.domain.com/o/image.jpg full resolution
有谁知道我怎么能强迫图像文件在/ o /下载而不是在网络浏览器中呈现?
这是我的conf文件:http://pastebin.com/dP8kZMzx
#setup subdomain i.domain.com
server {
server_name i.domain.com;
access_log /var/log/nginx/i..com.access.log;
error_log /var/log/nginx/i.domain.com.error.log;
root /var/www/domain.com/test1/images;
index index.php index.html index.htm;
#error_page 403 = /notfound.jpg;
#error_page 500 = /notfound.jpg;
location/{
#change this to a 404 img file .jpg
try_files $uri $uri/ /notfound.jpg;
rewrite "/s([A-Za-z0-9.]+)?" /small/$1 break;
rewrite "/o/([A-Za-z0-9.]+)?" /orig/$1 break;
rewrite "/([A-Za-z0-9.]+)?" /medium/$1 break;
}
}
这导致404错误:/ – eeek 2012-02-13 18:39:03
此链接为我的作品:HTTP://210mike.com/force-file-download-nginx-apache/ 位置〜* (。* \。pdf){ types {application/octet-stream .pdf; } default_type application/octet-stream; } – learnJQueryUI 2016-04-25 04:57:33