0

I'm trying to troubleshoot the following: "Connection timed out while reading response header from upstream"

Setup is VestaCP latest version 0.9.8 running. PHP 5.5.9. apache and nginx as proxy.

I've spent hours trying different things.

I've looked here: NGINX: upstream timed out (110: Connection timed out) while reading response header from upstream

and here: nginx close upstream connection after request

Those answers suggest: setting proxy_http_version 1.1; and proxy_set_header Connection "";

I did that but it didn't help. How can I troubleshoot this further and find the problem?

It seems erratic, if I restart nginx and apache2 (service restart ...) it will proccess one or two requests before throwing the 504 gateway timeout error and logging "Connection timed out while reading response header from upstream"

My main pages actually work fine (see: https://eastward.edu.au/). But any ajax requests sent to my backend (https://eastward.edu.au/~do) are coming back as timed out.

I drilled down a bit further and it seems that php session_start(); could be where it is getting hung up? Whether it is that, or that is the catalyst I'm not sure.

That's as far as I've been able to figure out.

EDIT

Try doing one or two (fake) subscriptions on my homepage (https://eastward.edu.au/, top right), and then visit: https://eastward.edu.au/~do

It should timeout after 90 seconds.

The actual error log reads:

2016/09/08 00:43:12 [error] 4706#4706: *152 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 1.144.96.101, server: eastward.edu.au, request: "POST /~do HTTP/1.1", upstream: "https://45.56.85.76:8443/~do", host: "eastward.edu.au", referrer: "https://eastward.edu.au/"

Community
  • 1
  • 1
Emmanuel
  • 4,933
  • 5
  • 46
  • 71

1 Answers1

0

The issue was that session_start() was causing the server to hang.

I solved the issue by following these steps: session_start hangs

Community
  • 1
  • 1
Emmanuel
  • 4,933
  • 5
  • 46
  • 71