I know this has been asked before, but I could not find a definitive
answer.
I tried different solutions, nothing worked.
I have a PHP script that has to do time intensive operations and provide
a
status update from time to time. No way around it.
I built a sample PHP script:
In nginx I have
location ~ .php$
{
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
include fastcgi_params;
Don’t forget taking into account browser buffering: depending on which
one
you are using, it waits for a certain amount of data before displaying
anything.
To convince you of that, listen to the incoming network traffic to check
that data is arriving to the client.
That’s a limit upon you cannot do much.
To ensure configuration of the PHP part is done correctly, you can dump
communication between nginx and PHP.
With all that, you should be able to reach some conclusions.
OK, so I modified nginx and php5-fpm to talk on port 9000 and used
tcpdump
to see the traffic. It looks like it worked as packets arrived at 1
second
intervals (the sleep(1) in my code).
However in browser it was still the same.
After more testing, it turns out there’s something in my computer
configuration that’s causing it. Not sure yet if it’s the antivirus or
something else, but trying on different computer worked, as it did
using
lynx on the server.
Posted at Nginx Forum:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.