Sometimes you may encounter a 502 or 504 Bad Gateway Timeout Error when you try to access your web application. This error means that the web server did not receive a valid response from the upstream server (such as PHP-FPM or Apache) within a certain time limit.

There are many possible causes for this error, such as:

  • Errors in your code or configuration files.
  • Redirect loops or infinite loops.
  • Server overload or downtime.
  • Invalid or slow response from the upstream server.
  • DNS issues or misconfiguration.
  • Low memory or storage space on the server.
  • FastCGI errors or internal Linux kernel errors (these require technical support).
  • No database selected for your web application (you can check this in your web application settings).

To fix this error, you can try some of the following solutions:

  • Clear your browser cookies and cache.
  • Reload your web page by pressing F5 or Shift+F5.
  • Start your browser in safe mode or use a different browser.
  • Try to access your web application from another device or network.
  • Increase the values of some of the PHP settings by using the RunCloud dashboard or the terminal. The settings may include:
    • max_execution_time
    • max_input_time
    • max_input_vars
    • memory_limit
    • post_max_size
    • upload_max_filesize
  • Check your code and configuration files for any errors or syntax issues. You can use a code editor or a syntax validator tool to check your code. You can also check the error logs for any clues or messages.
  • Check your .htaccess file or NGINX configuration file for any redirect loops or infinite loops. A redirect loop occurs when a web page redirects to another web page that redirects back to the original web page, creating an endless cycle. An infinite loop occurs when a code block repeats itself indefinitely without a terminating condition.
  • Check your DNS settings and make sure that they are correct and up-to-date.
  • Check your server memory and storage space and make sure that they are sufficient for your web application needs. You can use the RunCloud dashboard to see your server statistics and alerts.
  • Select the correct database for your web application from the web application settings menu in your RunCloud dashboard.

If none of these solutions work, please contact RunCloud support by submitting a support ticket from your RunCloud dashboard. We will try to help you with your issue as soon as possible.