I moved one of my old sites from an Apache to an nginx server. Everything is working fine but the site has some long content (a +100k generated HTML file).
My first trial was to disable chunked transfer encoding, but that 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/nginx.pid;
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/example.com
server {
listen 443 ssl;
server_name example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
charset iso-8859-2;
root /var/www/public/example.com;
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;
fastcgi_pass 127.0.0.1:9000;
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 weird things going on. Firebug shows me the page is being cached, but I don't know why.
UPDATE:
Finally I can reproduce the issue by using the following PHP script:
<?php
//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) {
$i--;
printf("%10s", $i);
if (!($i%50)) {
echo "\n";
}
$a = $undefined;
}
This script runs and terminates normally if I exclude E_NOTICE
from error reporting.