---
title: 'Error 504 524 Gateway Timeout (solved) | Zomro'
description: 'The 504 524 Gateway Timeout error is an HTTP status code that means that one server did not receive a timely response from another server it was accessing while trying...'
image: 'https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/07/01/1657637892_1.png'
---

![opened image]()

  * [Zomro](https://zomro.com/)
  * [FAQ](https://zomro.com/blog/faq/)
  * Error 504 524 Gateway Timeout (solved) 



# Error 504 524 Gateway Timeout (solved)

12-07-2022

The 504 524 Gateway Timeout error is an HTTP status code that means that one server did not receive a timely response from another server it was accessing while trying to load a web page or make another browser request.  


**Causes of 504 524 Gateway Timeout Errors**

  
In most cases, a 504 or 524 Gateway Timeout error means that the request that is sent to the server takes time than set on the server, or for example on CloudFlare. Usually these can be CRON jobs, or any other requests that require a large amount of time to execute.  
  
As for the 504 or 524 error that we see on Cloudflare, it says that the connection to the origin web server was successful, but the origin did not provide an HTTP response after 100 seconds, which is set by default. (This limit is set on the free plan). Enterprise customers can increase the timeout to 600 seconds.  
  
But in this article, you can learn how you can set up a VPS server so that by raising the limits, we can bypass the 100 second ClodFlare limit.  
  
  
If we have the ISP Manager panel installed, log in to the panel as root, select WWW-Domains, then tick the desired domain, and click Configuration Files.  
  
![Error 504 524 Gateway Timeout \(solved\) - 1](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/07/01/1657637892_1.png)  
  
  
For sites on the Vesta panel, the configs can be found in the following path:  
  
To edit nginx **/home/admin/conf/web/******.nginx.ssl.conf**  
  
To edit apache**/home/admin/conf/web/******.httpd.ssl.conf**  
  
  
First, we change the Apache config by adding the Timeout directive there. This must be done before the **/VirtualHost** closing tag. As shown in the illustration.  
  
  
![Error 504 524 Gateway Timeout \(solved\) - 2](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/07/01/1657637903_2.png)
    
    
    <VirtualHost 127.0.0.1:8080>
    ...
    
    Time Out 1800
    </VirtualHost>

  
  
Next, we change the nginx config by adding **"location @fallback {...}"** to the block as shown in the illustration:  
  
  
![Error 504 524 Gateway Timeout \(solved\) - 3](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/07/01/1657637902_3.png)  
  
If the site is running in Apache mode (CGI, FastCGI), then:
    
    
    proxy_connect_timeout 1800;
    proxy_send_timeout 1800;
    proxy_read_timeout 1800;
    send_timeout 1800;

If the site is running in PHP-FPM, then:
    
    
    fastcgi_connect_timeout 1800;
    fastcgi_send_timeout 1800;
    fastcgi_read_timeout 1800;
    send_timeout 1800;

  
  
If such a timeout needs to be applied to all sites on this server, which is not recommended, then this construct must be added to the **http** block of the nginx server config. Location **/etc/nginx/nginx.conf**  
  
![Error 504 524 Gateway Timeout \(solved\) - 4](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/07/01/1657637912_4.png)  
  
After that, exactly the same timeouts must be added to the PHP configuration directives **max_input_time** and **max_execution_time**. This must be done in the settings of the selected PHP version that is installed on this site.  
  
  
If you have the ISP Manager panel installed, you need to go to "**Web Server Settings** ", then select the "**PHP** " item, check the desired PHP version and click "**Advanced Settings** "  
  
  
![Error 504 524 Gateway Timeout \(solved\) - 5](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/07/01/1657637971_5.png)  
  
  
In the search, write **max_input_time** and **max_execution_time** and set the value to **1800**. Again, it should be the same in all configs!  
  
  
![Error 504 524 Gateway Timeout \(solved\) - 6](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/07/01/1657637971_6.png)  
![Error 504 524 Gateway Timeout \(solved\) - 7](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/07/01/1657637970_7.png)  


If you have Vesta installed, then you need to go to the Server menu and select **httpd** or **php-fpm**  
  
  
![Error 504 524 Gateway Timeout \(solved\) - 8](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/07/01/1657637976_61.png)  
  
![Error 504 524 Gateway Timeout \(solved\) - 9](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/07/01/1657638053_71.png)

Or edit the **/etc/php.ini** file from the console and set the value to **1800** for **max_input_time** and **max_execution_time**.  
  
Then we restart **httpd** and **nginx** , as well as **php-fpm** if it is installed.  
  
For **Centos** :
    
    
    systemctl restart httpd
    systemctl restart nginx
    systemctl restart php-fpm

  
For **Ubuntu** :
    
    
    systemctl restart apache2
    systemctl restart nginx
    systemctl restart php-fpm

  
  
We start the task or the desired script.

Similar articles:

[Changing Priority from IPv6 to IPv4 in Ubuntu and CentOS: A Complete Guide](https://zomro.com/blog/faq/471-changing-priority-from-ipv6-to-ipv4-in-ubuntu-and-centos-a-complete-guide) [PowerShell: Sending messages to Telegram](https://zomro.com/blog/faq/352-powershell-sending-messages-to-telegram) [Install ffmpeg-php on Centos 7 and Ubuntu 20](https://zomro.com/blog/faq/345-install-ffmpeg-php-on-centos-7-and-ubuntu-20) [How to connect custom ISO image to dedicated server](https://zomro.com/blog/faq/234-kak-podkljuchit-svoj-obraz-iso-k-vydelennomu-serveru) [How to install NextCloud on Docker](https://zomro.com/blog/faq/302-kak-ustanovit-nextcloud-v-docker)

[ GPU server from €174.80/mon ](/dedicated-servers/type=gpu)
