Alexander2016-09-22 13:57:13
Alexander, 2016-09-22 13:57:13

502 nginx error, but the "long" php script is executed correctly. What is the reason?

Hello toaster!
I have a specific php script that takes 15-20 seconds to complete.
Inside the script, there is work with the database, copying files, etc.
The server has 2GB of RAM. In addition to this script, there is practically no load on the server.
In php.ini max_execution_time = 90, memory_limit = 512M.
In the nginx config I wrote:

proxy_connect_timeout       60s;
proxy_send_timeout          60s;
proxy_read_timeout          60s;
send_timeout                60s;

I run the script, it runs for ~15 seconds, and the browser crashes into "502 Bad Gateway". But at the same time, the script does all the necessary work correctly.
In the nginx logs I see this:
2016/09/22 12:45:21 [error] 15220#0: *39 upstream prematurely closed connection while reading response header from upstream ...

Tell me, please, in which direction to dig.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Vitaly, 2016-09-22

link see this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question