Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I moved one of my old site from an apache to an nginx server. Everything is working fine but the site has some long content above 100k generated html.

My first trial was to disable chunked transfer encoding, but did not help.

Here it is my nginx config:

$ cat /etc/nginx/nginx.conf
user www-data;
worker_processes  1;

error_log  /var/log/nginx/error.log;
pid        /var/run/;

events {
    worker_connections  1024;

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

    sendfile        on;
    keepalive_timeout  65;
    tcp_nodelay        on;

    gzip  on;
    gzip_static on;
    gzip_http_version   1.0;
    gzip_disable        "MSIE [1-6]\.";
    gzip_vary           on;
    gzip_comp_level 1;
    gzip_proxied    any;
    gzip_types      text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;
    gzip_buffers    16 8k;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

$ cat /etc/nginx/sites-enabled/
server {
    listen   443 ssl;

    access_log /var/log/nginx/;
    error_log /var/log/nginx/;

    charset iso-8859-2;
    root   /var/www/public/;

    chunkin off;
    chunked_transfer_encoding off;

        location ~ ^.+\.php {
          fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
          fastcgi_param SCRIPT_NAME $fastcgi_script_name;
          fastcgi_param PATH_INFO $fastcgi_path_info;
          include        fastcgi_params;

        location / {
          index index.php;
          try_files $uri /index.php?$args;

    ssl_certificate     /etc/nginx/ssl/server.crt;
    ssl_certificate_key /etc/nginx/ssl/server.key;


There are some wired thing. The firebug show me the page is cached, but I don't know why. (I have no enough reputation to post an image)


Finally I can reproduce the issue whit this php script:

//error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED); //the whole content printed as expected
error_reporting(E_ALL & ~E_DEPRECATED); //truncated content
header("Content-Type: text/plain; charset=iso-8859-2");

$i = 500000;
while ($i) {
  printf("%10s", $i);
  if (!($i%50)) {
    echo "\n";
  $a = $undefined;

This script run and terminate normally when I excluded E_NOTICE from error reporting.

share|improve this question
I just opened a ticket and it seems the I have problem with old version of PHP. – oliver nadj Jun 11 '13 at 7:35

3 Answers 3

up vote 3 down vote accepted

Check permission of these directories:

  • client_body_temp_path
  • proxy_temp_path
  • fastcgi_temp_path

It is likely that one or all of these directories is not writable for nginx. These temp folders act as buffers for nginx when handling big requests, if nginx cannot write to them then nginx just returns the content which is stored in its memory.

You should also see errors similar to below in your error logs, if not check your log level / log path again.

2013/10/07 11:01:09 [crit] 3307#0: *33 open() "/var/lib/nginx/tmp/proxy/2/00/0000000002" failed (13: Permission denied) while reading upstream
share|improve this answer
After searching for hours how to fix a Wordpress chunked Transfer Encoding Issue this has finally solved it. Bless! – flunder Jan 23 at 17:43

Possible connection with this bug , try updating nginx.

share|improve this answer
Thx @Andrei, I updated nginx to 1.4.1 but the issue is still exists. – oliver nadj Jun 10 '13 at 14:29
Does turning off gzip in nginx have any effect on size or anything? – Andrei Mikhaltsov Jun 10 '13 at 14:46
I already tried to disable gzipping, chunked ancoding and the ssl, but it did not help. – oliver nadj Jun 10 '13 at 15:07

Not necessarily to do with html only, but also JS and CSS files, the sendfile option could be an issue too.

As reported in turning

sendfile off

can mean your files are not truncated

share|improve this answer

Your Answer


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.