Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We have a problem with loading a pdf file which is about 300KB size on our web page. The pdf is being served by nginx. Whenever I load the file, it shows an error saying Failed to open pdf document, but the size of the crashed file is only 32KB. I have double checked about size on the both ends.

After I checked clicked_site(client_max_body_size),I had added the following configuration to nginx.conf:

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;

    client_max_body_size 200M;
    client_body_buffer_size 50M;
    client_header_buffer_size 300K;
    large_client_header_buffers 2 1k;

    proxy_buffer_size     40k;
    proxy_buffers      4 32k;

    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    ........

    ........

}

sites-enabled/default:

 server {
   server_name www.domain.com;
   #root html;

   location /static/admin/ {
             alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/;
    }

  location / {
             # host and port to fastcgi server
             fastcgi_pass 127.0.0.1:8090;
             fastcgi_param PATH_INFO $fastcgi_script_name;
             fastcgi_param REQUEST_METHOD $request_method;
             fastcgi_param QUERY_STRING $query_string;
             fastcgi_param CONTENT_TYPE $content_type;
             fastcgi_param CONTENT_LENGTH $content_length;
             fastcgi_pass_header Authorization;
             fastcgi_intercept_errors off;
    }

    location /site_media/ {
             alias /intcen_media/;
             #root /flat;
             autoindex on;
    }
}

In site-media I have the files directory contains pdf and swf files.

Does anyone see an error in my configuration that would cause this problem?

share|improve this question
    
What's opening the PDF - is it Acrobat Reader? It does some abnormal things. If so, see if you get the same behavior elsewhere - grap it with curl or wget. –  Shane Madden Dec 8 '11 at 18:19
    
@shane Thanks for the comment –  Navaneethan Dec 9 '11 at 9:29

1 Answer 1

Use curl or another tool to check the headers to be sure you are specifying the correct mime type for the PDF file. You should be pulling in mime.types into your config.

If you are doing that, then I would drop the client_* and related buffers. I have nginx working without these and serving PDF/SWF without issue.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.