I currently have 2 image locations and they may the formats (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
Does anyone know how I can force image files in /o/ to download rather than render in the web browser?
Here's my conf file: 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;
}
}
Definition of Nginx Autoindex. Nginx autoindex is used the ngx http autoindex module to process the requests which was ending with the “/” slash character and it will produce the listing directory. Basically, the request is passed by using the ngx http autoindex module when the specified module will not find the index.
Serving static files using nginx as web server is a good option. For making the static files available you need to copy your testfolder to /usr/share/nginx/html inside the nginx image. After which you will be able to see the files on your browser on port 8080.
You just need to return HTTP header Content-disposition
:
location ~* /orig/(.+\.jpg)$ {
add_header Content-disposition "attachment; filename=$1";
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With