Membership Membership:
Latest New User Latest: vpros
Past 24 Hours Past 24 Hours: 0
Prev. 24 Hours Prev. 24 Hours: 0
User Count Overall: 137

People Online People Online:
Visitors Visitors: 48
Members Members: 0
Total Total: 48

NakedMCSE Computer Tech Support Forums

So you have passed all of the exams and you are now out in the real world of windows servers, linux servers and freebsd servers faced with a tech support problem you have never seen before...

Find free online tech support in the forums below, respecting that advice is free, but work beyond advice is not...

The General forum is provided for off topic discussion.

You need a user account to post - please Register or Login.

Online Tech Support Forums
 
  Forum  Open Source Tec...  NGINX Server  NGINX Forcing a file type to default to download instead of its mime type
Previous Previous
 
Next Next
New Post 12/30/2009 2:52 PM
Informative
  Walker
119 posts
www.lairdscomputer.com
10th Level Poster


NGINX Forcing a file type to default to download instead of its mime type 
Modified By Walker  on 12/30/2009 4:04:19 PM)

Suppose you want to force a filetype like .pdf to download by default instead of opening up in the browser.  You can do this by altering its mime type from whatever it defaults to to 'application/octet-stream'.

On a global scale, this is most simply accomplised by editing the conf/mime.types file and changing the entry for the required extension to 'application/octet-stream'.

On a folder scale, this can be accomplished by using the following:

location /download/ {
  types {
        text/html  html htm shtml;
        text/css   css;
        text/xml   xml;
        image/gif  gif;
        image/jpeg jpeg jpg;
    }

  default_type application/octet-stream;
}

This will leave the basic html rendering types intact and revert everything else to 'application/octet-stream'.

Walker
www.lairdscomputer.com

 
Previous Previous
 
Next Next
  Forum  Open Source Tec...  NGINX Server  NGINX Forcing a file type to default to download instead of its mime type
Send me One Million FREE Guaranteed Visitors