【发布时间】:2012-02-21 16:26:53
【问题描述】:
我目前有 2 个图像位置,它们可能是格式(jpg、jpeg、png、gif)
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;
}
}
【问题讨论】:
-
试图弄清楚如何让它在混合的 Apache/Nginx 设置中工作很长时间。最后只是从 Nginx 直接提供的文件类型列表中排除 pdf 并在 .htaccess 中设置
AddType application/octet-stream .pdf
标签: nginx mime-types