How do I configure nginx to serve PDF files? [closed]

I am starting with a default installation of nginx. The only modification I've made to my enabled-sites/default file is:

root /home/ubuntu/www

...where I have a web site and a /pdf folder that contains my pdf files.

If I click a link to a pdf file, it gets served as text/html and of course looks rather broken in the browser window.

If I add Jeremy's configuration section from http://www.jeremywalworth.com/index.php?q=taxonomy/term/49, then I get 404's for the same pdf file link.


Solution 1:

check if the mime.types file has this entry

application/pdf                       pdf;

and if you include the mime.types file in the http section of your conf

http {
    include       /etc/nginx/mime.types;
...
}