A timeout occurred: Error code 524

Hi everyone,

I have a site that I installed in a VPS running with Cyberpanel, 6 vCPU Cores and 16 GB RAM from Contabo.
After a period of normal use, a problem occurred to me, which is that the site has stopped with error 524, and this only happens because the site is linked to cloudflare.
I don’t get much visits about 1k a day.
When I unlink cloudflare the site works fine.
I tested the subdomain with cloudflare and found it to work normally without any problem

Is there a solution to this problem? I want to keep Cloudflare.

Welcome @souhaibboukh Happy New Year

Cloudflare basic plan has a timeout of maximum 100 seconds where cf will close the connection and throw the 524 error if connection was not successful by 100 seconds.

To remedy this issue restart Litepeed server

# start here copy line bleow me
rm -f /var/lib/lsphp/session/lsphp71/* && rm -f /var/lib/lsphp/session/lsphp72/* && rm -f /var/lib/lsphp/session/lsphp73/* 
# then copy line below me
rm -f /var/lib/lsphp/session/lsphp74/* && rm -f /var/lib/lsphp/session/lsphp80/* && rm -f /var/lib/lsphp/session/lsphp81/*
rm -rf /var/lib/lsphp/session/lsphp73; mkdir -p /var/lib/lsphp/session/lsphp73; chmod 1733 /var/lib/lsphp/session/lsphp73

service lsws condrestart

A permanent solution if these steps work

sh <(curl https://raw.githubusercontent.com/josephgodwinkimani/cyberpanel-mods/main/cyberpanel_sessions_cronjob.sh || wget -O - https://raw.githubusercontent.com/josephgodwinkimani/cyberpanel-mods/main/cyberpanel_sessions_cronjob.sh)

Else if all fails

Check this out MariaDB / MySQL Tweaks As Default & Option

Basically run nano /etc/my.cnf use the keyboard shortcut CTRL+W to search for skip-name-resolve and comment it out. Restart mariadb systemctl restart mysqld

what is the SSL mode in Cloudflare for your site?

It’s flexible

This issue also affects my site. But after switching to Cloudways from Contabo, it stopped. The funny thing is that subdomains work when the main domain throws the Error 524.

What does this do?

1 Like

Same thing when I moved from Contabo to Hetzner I didn’t see this problem at all