Steps to resolve Magento 504 gateway timeout error

Steps to resolve Magento 504 gateway timeout error

Steps to resolve Magento 504 gateway timeout error

504 gateway errors in Magento – A load balancer plays a role in displaying 504 gateway timeout errors. You can ask me why? A load balancer is the one which receives the webserver request. If the load balancer doesn’t get webserver request then it displays the error “504 gateway timeout”.

This is not the reason exactly behind 504 but it’s just a survey from the users who usually get this error by load balancer inability. In detail, when a user types the website name in the browser immediately the webserver takes the responsibility to load the pages in the website. In case, if the website gets a late response or it failed to load a page then you will be displayed with this error. Coming to the technical base, there is a problem between IP and web (front and back end). Overall, the problem starts with the non-functionality of the webserver.

Here are the lists of other reasons to display 504 errors:

  1. The inefficiency of the server process
  2. Rejection of the firewall will trigger the reset option so that it tends to stop the connection.
Let us start fixing the problem by cross-checking the below list:

  • Magento cache and browser cache clearance:
It’s just to clear the Magento cache whenever you make changes in the website. Or else, it won’t be updated unless you do cache clearance. Not only, but Magento cache does work on browser cache too!

Steps to clear Magento cache from admin panel:

Method 1: In your Magento admin panel, choose the option “system” and then select cache management. Here, we are flushing out the caches so choose “flush cache storage”.

Method 2: Go to var/cache/directory delete the content inside after then load the website again. For Magento cache clearance, go to the installation directory of Magento and then go to the pathway var/cache/ folder. Delete the content inside the folder. That’s it!
  • PHP limitations exceeded:
Whenever website base code goes out of the limit it will impact in the PHP limitations. Hence, PHP limitations too are the reason to bring 504 errors. Before it goes out of the limit simply increase the volume of the limitation. Go to php.ini file to make changes as mentioned below:

For updating the changes, kindly save php.ini file so that you can restart the service for Apache.

Ubuntu: service apache2 restart
CentOS server : service httpd restart
Nginx server: fastcgi_buffers 8128k;

proxy_read_timeout 600;
fastcgi_buffer_size 256k;
fastcgi_read_timeout 600;
To make changes in Nginx webserver select the file by redirecting to the pathway /etc/nginx/nginx.conf.
  • Firewall configuration fault fix:
Firewall configuration may also be the hidden reason for 504 errors. Let us deal the firewall problem separately so that it won’t affect website performance. Try to sort out the problem or else make a temporary lock by disabling the firewall.
  • Propagations of DNS:
DNS record – Simple deal! Usually, when you change the IP address of the website or host server DNS will take more time to update the changes. May be two to three hours of space for changes! It depends upon the website space.

So, DNS will stop the website service until it gets authority fully. The website performance gets normal only if the propagation of DNS completed fully.
  • Server high traffic:
A server must have the ability to deal high traffic whatever may be the instance. In that case, if the server can’t withstand then it will show 504 gateway errors. Try to do configurations in a server such as server resources, add and tweak. These are said to be server optimization.
  • Session lock:
Session lock is another big reason for gateway timeout. Magento has the default feature to set up the session lock unless the page gets loaded fully. If the customer wishes to execute a big-run process or low-run process the DNS remains same as constant. DNS waits for the execution to complete only so, the website will be loaded fully.

Just give a try by using the incognito window to verify the process. Prefer task schedule or command line execution for the long-run process. Do not open the web browser until you complete the long-run process.

The above-listed reasons are the reference for the problem “504 gateway timeout”. So, give a try to resolve it by given suggestions.
First release
Last update
0.00 star(s) 0 ratings

More resources from bhawanisingh