Getting Started

Deployment Deployment - Diagnose Migrations Staging

Site Management

Backups Client Reporting Passwords Plugin Automation Plugin Management - Global Plugins & Themes - Diagnose Plugins & Themes - General Plugins & Themes - Git Plugins & Themes - Logs Must Install White Label WordPress Updates

Caching & Performance

Caching Caching - Blogs/Articles Caching - Diagnose Caching - Git Caching - WooCommerce Redis Optimize & Scale

Security

Security Security - Firewall

SMTP, CDN & DNS

SMTP SendGrid CDN CDN - AWS CDN - Cloudflare CDN - Diagnose Domains & DNS

Server & Tools

Analytics & Logs CRON Jobs Database Debug Tool Git Monitoring PHP Settings Redirects SEO Tools Server Errors sFTP SSL

Staq Billing

Staq Billing > Account Staq Billing > Client Staq Billing > Setup

Media

Media Media - Diagnose Media - Optimize

Accounts & Billing

Accounts & Billing

General

WordPress Hosting Website Diagnose Troubleshoot - Other

504 Gateway Time-out error


On this page

    A 504 Gateway Time-out error typically occurs when your website’s PHP workers are overwhelmed and unable to process requests. Each hosting plan on Staq is assigned 10 PHP workers by default, which is usually sufficient for most websites. However, certain plugins or configurations can cause PHP workers to hit their maximum capacity, resulting in this error.

    PHP Workers Assessment

    To assess how many PHP Workers a particular site has, in Staq Panel, under Advanced, click PHP Config and you’ll see the value under Max PHP Workers.

    In order to see if PHP Workers have hit their limits, go to the site’s Staq Panel and under Metrics, click PHP Workers. Then select Hourly > 3 followed by Parallel PHP Workers:

    If the site’s default is 10, in the graph below, you can see that it’s hitting its limit.

    Common Causes

    The common causes of a site hitting maximum PHP Workers are listed below but not limited to:

    • Preloading cache pages from performance plugins such as Nitropack, WP Rocket and BerqWP
    • Search engines or bots from Facebook randomly visiting uncached pages which fills up the PHP-FPM pool
    • Trusted bots (listed as trusted bots on the Staq infrastructure) continues to bombard the site with requests.

    Resolving the 504 Error

    To address this issue, follow these steps:

    Optimize Your Plugins

    • Review and configure your caching plugins carefully. Disable or adjust the preloading features to reduce their impact on server resources.
    • If preloading is unnecessary, consider disabling it to alleviate the load on PHP workers.

    Enable Staq Cache

    • Staq Cache is a highly efficient caching solution integrated with Staq Hosting.
    • It improves website performance by reducing the load on PHP workers.
    • Once enabled, preload the cache carefully to avoid overloading PHP workers.

    Scale Up PHP Workers

    • If your website consistently exceeds the default limit of 10 PHP workers, consider scaling up.
    • Refer to this guide for instructions: How to Increase PHP Workers.

    Ban particular requests from trusted bots like Facebook

    If there’s no reason for a bot like Facebook or Apple to crawl a site, you can simply disable their access using Staq Firewall by following this guide.

    Preloading the Cache

    While preloading the cache is a useful feature, it should be configured judiciously. Overuse can lead to excessive PHP worker usage. Always monitor server performance while preloading is enabled.

    Alternatively, you can enable Staq Cache which has a more efficient preloader function.

    Conclusion

    A 504 Gateway Time-out error is a sign that your website’s PHP workers are under stress. By optimizing plugins, enabling Staq Cache, and scaling up PHP workers if needed, you can resolve this issue effectively and ensure your website runs smoothly.

    If you encounter further issues or require assistance, don’t hesitate to reach out to our support team.

    Need some help?

    We all do sometimes. Please reach out to our support team by dropping us a support ticket. We will respond fast.