Bobcares

WeSupport

Call Us! 1-800-383-5193
Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Emergency Response Time custom

Our experts have had an average response time of 11.06 minutes in March 2021 to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

Nginx “upstream timed out” error – How we tackle it

by | Apr 26, 2021

Nginx “upstream timeout (110: Connection timed out)” error appears when nginx is not able to receive an answer from the webserver.

As a part of our Server Management Services, Our Support Engineers helps webmasters fix Nginx-related errors regularly.

Let us today discuss the possible reasons and fixes for this error.

What causes Nginx “upstream timed out” error

The upstream timeout error generally triggers when the upstream takes too much to answer the request and NGINX thinks the upstream already failed in processing the request. A typical error message looks like this:

Nginx upstream timed out

Some of the common reasons for this error include:

  • Server resource usage
  • PHP memory limits
  • Server software timeouts

Let us now discuss how our Support Engineers fix this error in each of the cases.

How to fix Nginx “upstream timed out” error

Server resource usage

One of the most common reasons for this error is server resource usage. Often heavy load makes the server slow to respond to requests.

When it takes too much time to respond, in a reverse proxy setup Nginx thinks that the request already failed.

We already have some articles discussing the steps to troubleshoot server load here.

Our Support Engineers also make sure that there is enough RAM on the server. To check that they use the tophtop or free -m commands.

In addition, we also suggest optimizing the website by installing a good caching plugin. This helps to reduce the overall resource usage on the server.

PHP memory limits

At times, this error could be related only to specific PHP codes.  Our Support Engineers cross-check the PHP FPM error log in such cases for a more detailed analysis of the error.

Sometimes, PHP would be using too much RAM and the PHP FPM process gets killed. In such cases, we would recommend to make sure that the PHP memory limit is not too high compared to the actual available memory on the Droplet.

For example, if you have 1GB of RAM available your PHP memory limit should not be more than 64MB.

Server software timeouts

Nginx upstream errors can also occur when a web server takes more time to complete the request.

By that time, the caching server will reach its timeout values(timeout for the connection between proxy and upstream server).

Slow queries can lead to such problems.

Our Support Engineers will fine tune the following Nginx timeout values in the Nginx configuration file.

proxy_connect_timeout 1200s;
proxy_send_timeout 1200s;
proxy_read_timeout 1200s;
fastcgi_send_timeout 1200s;
fastcgi_read_timeout 1200s;

Once the timeout values are added, need to reload Nginx to save these parameters.

Conclusion

In short, Nginx upstream timed out triggers due to a number of reasons that include server resource usage and software timeouts. Today, we saw how our Support Engineers fix this error.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

SEE SERVER ADMIN PLANS

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF