• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue upstream timed out (110: Connection timed out) while reading response header from upstream

varoon

New Pleskian
Server operating system version
Ubuntu 20.04.5 LTS
Plesk version and microupdate number
Plesk Obsidian 18.0.47
Hi,

Im new to plesk and usgin it on linode.

We have a website developed in ReactJS, NodeJS and mongo db.

1849#0: *327290 upstream timed out (110: Connection timed out) while reading response header from upstream

Attached is the log on Nginx error.

Screenshot 2022-11-24 at 12.01.27 AM.png

My Nginx config file: /etc/nginx/nginx.conf

Code:
#user  nginx;
worker_processes  1;

#error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;

#pid        /var/run/nginx.pid;

include /etc/nginx/modules.conf.d/*.conf;

events {
    worker_connections  2048;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    #tcp_nodelay        on;

    #gzip  on;
    #gzip_disable "MSIE [1-6]\.(?!.*SV1)";

    server_tokens off;

    include /etc/nginx/conf.d/*.conf;

# added to test
        proxy_http_version 1.1;
        proxy_set_header Connection "";
}

# override global parameters e.g. worker_rlimit_nofile
include /etc/nginx/*global_params;


what is the reason for this error?

Any help on how to get rid of these?
 
Perhaps it is caused by the default timeout limit is 60 seconds for proxying requests from nginx to Apache. But the script takes more than 60 seconds to execute.
Try to add in Additional nginx directives field of domain Nginx settings to increase the timeout limit to 180 seconds (3 minutes):

proxy_connect_timeout 180s;
proxy_send_timeout 180s;
proxy_read_timeout 180s;
fastcgi_send_timeout 180s;
fastcgi_read_timeout 180s;
 
Thanks for the reply.

ok, i will add them inside the http right?

Code:
http {
......

proxy_connect_timeout 180s;
proxy_send_timeout 180s;
proxy_read_timeout 180s;
fastcgi_send_timeout 180s;
fastcgi_read_timeout 180s;

......
}

Will test and update...
 
just a query:
Since we use ReactJS, NodeJS and MongoDB web app, Do I need Apache?
can I disable Apache? will it affect the website?
 
Hi!
In the current implementation, you can't disable Apache at all on the server level. However, you can do it for a single domain or service plan: https://support.plesk.com/hc/en-us/articles/213924385

The timeouts above are to be added in Plesk > Domains > example.com > Apache & nginx settings > Additional nginx directives. See this for reference: https://support.plesk.com/hc/en-us/articles/115000170354

In general, "110 timeout error" is very general and means that nginx waited for some time (60 sec, by default) to get the answer from Apache (upstream) but got nothing in return. SO increasing timeout will either fix the issue at all or will probably give a clue of what is happening
 
Perhaps it is caused by the default timeout limit is 60 seconds for proxying requests from nginx to Apache. But the script takes more than 60 seconds to execute.
Try to add in Additional nginx directives field of domain Nginx settings to increase the timeout limit to 180 seconds (3 minutes):

proxy_connect_timeout 180s;
proxy_send_timeout 180s;
proxy_read_timeout 180s;
fastcgi_send_timeout 180s;
fastcgi_read_timeout 180s;
After adding this to the http block, i restarted the Linode serve, the website did not work!
reverting the original conf file, the server started.

Actually, yesterday I added this mentioned from some other blog, (proxy_connect_timeout 180s; and other values)
created a file and pasted on this location: /etc/nginx/conf.d/timeout.conf

Am i doing anything wrong? Did i miss someting?
 
After you added the timeout.conf file: What is the result of
# nginx -t
?
it throws duplicate proxy_connect_timeout
So removed and restarted Linode. server

Now I receive a slightly different errors

Totally 3 different:

#1: No more recent errors (Fixed I think, let me check and update if it occurs again)
Code:
1849#0: *327290 upstream timed out (110: Connection timed out) while reading response header from upstream

#2: still occurs
Code:
2091#0: *29828 connect() failed (110: Connection timed out) while connecting to upstream

#3: still occurs
Code:
3231#0: *13332 peer closed connection in SSL handshake (104: Connection reset by peer) while SSL handshaking to upstream
 
Am i doing anything wrong? Did i miss someting?
Why do you edit the nginx global configuration file manually instead of making these changes through the Plesk UI for a specific domain, as I wrote above?
 
Why do you edit the nginx global configuration file manually instead of making these changes through the Plesk UI for a specific domain, as I wrote above?
My Bad!. You are right. Actually, i did not know we can do on the Plesk itself. did not understand that.
Now Added them as mentioned Thanks!
 
Does not seem to solve the issue.

What else should I do to fix this?

I still get errors
Code:
2070#0: *16414 upstream timed out (110: Connection timed out) while reading response header from upstream

Screenshot 2022-11-27 at 10.22.06 AM.png
 
Back
Top