Bobcares

HTTP status 504 gateway timeout – Quick remedies for you

by | May 1, 2019

Website errors are difficult to decode especially when it shows strange error codes.

A typical example is 504 gateway timeout which occurs due to bad DNS server settings, Firewall settings, timeout settings and much more.

That’s why, we often get requests from our customers to fix 504 gateway timeout error as part of our Technical Support Services.

Today, let’s understand what is 504 gateway timeout error and reasons on why this error occurs, also the way Bobcares’ Engineers fix it.

 

What is a 504 Gateway Timeout Error

A 504 gateway timeout is HTTP status code, indicating an error on the server side.

Also, it indicates that a web server trying to load a page has not received a timely response from another server. Usually, this means the other server is down or not functioning properly.

There are several reasons why the server was unable to complete the request within the given time frame. This includes,

  1. DNS Errors.
  2. Bad timeout Configuration.
  3. Wrong Firewall Settings.

Now, let’s see reasons for 504 gateway timeout error and how our Support Engineers fixed them.

 

DNS Error

A 504 gateway timeout error may occur due to the DNS issue, such as the domain’s A record is not pointing to the correct IP.

For example, one of our customers migrated the server to a new host. After that, he was getting 504 gateway timeout page on his website.

1. Then our Support Engineers checked the DNS settings by using dig command.

dig bobcares.com

2. From that, we found that the domain did not have a proper A record.

3. We updated the correct IP address for A record in WHM >> Home >> DNS Functions >> Edit DNS Zone.

Also, we asked customers to wait up to 48 hours for the DNS record to propagate completely.

That fixed the issue and the customer could access the site.

 

Improper Firewall Configuration

The bad configuration of firewall settings or certain rules preventing from connection establishment results in 504 gateway timeout error. Because of faulty firewall configuration, it misinterprets the requests from a content delivery network as an attack on the server and rejects them.

Here, our Support Engineers correct the server Firewall in such a way that it does not create a security risk for the server.

 

Incorrect proxy settings

The incorrect proxy setting may cause 504 gateway timeout error on the client’s side as well as the server’s.

For example in Nginx, our Support Engineers will check the configuration file for the app in /etc/nginx/conf.d/ and ensure that the given domain name is correct.

server {
listen 80;
listen [::]:80;

server_name domain.com;

location / {
proxy_pass http://localhost:3000/;
}
}

In addition, we will check Nginx resource settings in timeout.conf file and ensure that the parameters are set up correctly. Furthermore, if needed we will increase the following values.

proxy_connect_timeout  600;
proxy_send_timeout    600;
proxy_read_timeout    600;
send_timeout      600;

 

PHP Timeout Issue

The PHP timeout issues may cause a 504 timeout error. Again, this error occurs when a single PHP process runs for more than the max_execution_time.

To solve this issue, our Support Engineers have increased the PHP timeout values in the PHP settings on the server.

In Apache on Ubuntu, we took the following steps to edit php.ini for increasing the PHP timeout values.

1.  We edited the file php.ini

nano /etc/php5/apache2/php.ini

2. Then, we found the line for “max_execution_time”.

3. We increased the value max_execution_time and saved the changes.

max_execution_time = 30

4. At last, we restarted the service.

service apache2 restart

 

[Getting 504 gateway timeout” error? We are here to fix it.]

 

Conclusion

In short, HTTP status code 504 gateway timeout is a server-side error. It occurs when a web server trying to load a page do not receive a timely response from another server.

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.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

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

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

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
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

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

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

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