Admins eHow SysAdmin Tips & Tricks

June 2, 2009

Force Download on nginx

Filed under: Nginx — Tags: , , — admin @ 9:05 pm

if you want force download on nginx for all files except images use the following config :

server{
	listen 80;
	server_name test.localhost;
	location / {
		root /Users/vasil/test;
		if ($request_filename !~* ^.*?\.(jpg)|(png)|(gif)){
			add_header Content-Disposition: "$request_filename";
		}
	}
}

Powered by WordPress