7

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.

Seth
  • 423
  • 1
  • 4
  • 8
  • I got this working by regenerating the PDF; perhaps it was corrupted in some way. – Seth Nov 29 '11 at 22:48
  • I had this problem, and I had configured `mime.types` correctly. The problem was that nginx only sets the content-type on files it actually returns. If nginx is just a gateway to (in my case) a django site, the django code is responsible for setting `content-type` correctly – Qualia Feb 05 '20 at 12:32

1 Answers1

4

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;
...
}