I've got a Magento installation, which works perfectly from a customer's point of view. However, when you try and do batch tasks with the admin, Nginx often closes the connection to the browser early, causing an "empty reply from server" error in the browser. The backend task still goes on inside Apache until it completes. PHP is configured with Magento's default max_execution_timeout of 18000 seconds.

I found an article that kind of related to this, and suggested using the "send_timeout" directive in Nginx's config. So I set that to the same as max_execution_time of 18000 seconds. Then I created a PHP script which simply sleeps for 65 seconds (it seems to timeout at 60 seconds).

It's not just the browser that's got the issue. I get:

curl: (52) Empty reply from server

from cURL as well. I don't have any other obscure Nginx config rules in the HTTP directive. Anyone have any idea what might be going on here, and how to go about stopping this from happening? I'm getting a bit lost.

2 Answers 2


I would suggest splitting your batch task into smaller ones (like 10 seconds each) and use AJAX to refresh the page and show progress.

Waiting 60 seconds for a reply is too long, way too long. The longer your operation the more chances of failures you have.

By splitting into smaller batches, if one crashes, you will only lose a fraction.

  • I agree. However, this is how Magento works, and has been designed to work. And many large ecommerce sites around the world use the same platform, and this is how it's worked since it was practically built. I've managed to get around this with the cron by getting wget to call it via the backend Apache directly, so nginx doesn't cut it off half-way through a task. However, for tasks initiated via the admin by the user, I'm unable to take such a shortcut.
    – danneh3826
    Jan 5, 2012 at 12:46

Check your fastcgi timeout parameters (/etc/nginx/fastcgi_param.conf).

Or try bumping up the proxy_read_timeout 90; in /etc/nginx.conf.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.