Question

Timeout (524 & 504) Error WordPress Site

Hi everyone,

Droplet info: 1 GB Memory / 30 GB Disk / NYC3 - Ubuntu 16.04.1 x64

I run a WordPress website and I am getting a spic k in traffic which has caused the CPU to be over 100%. I am getting the 524 and 504 Timeout error for the front and backend.

I can’t get ahold of the person I used to use for server related stuff and I have no idea what I need to do to fix the problem.

I would appreciate any help. Thank you so much in advance.

Saeed


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Thank you everyone for your helpful answers.

After readiung your helpful replies, I deciced to resize my dropelt following this https://docs.digitalocean.com/products/droplets/how-to/resize/. And so far it seems all is ok. The site is loading fine now.

I will also upgrade Ubuntu once I figure how to do it safely.

Thank you again for all your help.

alexdo
Site Moderator
Site Moderator badge
March 13, 2023

Hello @saeeddarabi

I’ll recommend you examine the CPU usage on the droplet when the site is busy and check if the load is generated from a certain plugin or extension which is not vital to the website’s functionality.

You can try disabling plugins which appear to cause CPU usage and check if this makes any difference.

If you’re not familiar with monitoring server resources this article will be really useful.

https://www.digitalocean.com/community/tutorials/how-to-monitor-cpu-use-on-digitalocean-droplets

Hope that this helps!

KFSys
Site Moderator
Site Moderator badge
March 13, 2023

Hey @saeeddarabi,

So from your information, there are a couple of things that can be done.

I’ll break the answer into the comments as well as it might make it really long to read and overwhelming.

The answer will be set in the current 3 points:

  1. Resolve current issues
  2. Outdated Ubuntu version
  3. Optimization of Website and Server

Resolve current Droplet issues

At the moment your Issues are coming from the fact that you are generating too much traffic for the resources you have.

There are two ways to resolve such situations about

  • Optimize your Droplet and Website. That way less resources will be needed for the Website to run
  • Upgrade your Droplet’s recourses

Now, sometimes it doesn’t matter how much you’ll optimize your website, you still need more recourses. Having said that before you go toward that solution, you first need to try the optimization process

Ubuntu Outdated version

First and most important would be to upgrade your Ubuntu server. As you are using Ubuntu 16.04, which is heavily outdated you are using outdated OS, packages, and other tools which can cause worse performance for your application/website, not to mention vulnerability issues.

Upgrade Ubuntu or go for a new Droplet

There are two ways to go about this, either upgrade your Droplet from 16.04 to 22.04 OR create a new 22.04 Droplet and migrate your WordPress over to it.

Since the changes between 16.04 and 22.04 are far too big and there most probably would be issues along the way I usually recommend people to recreate their setup on a new Droplet and migrate the configuration over however upgrading the Droplet is also a possibility.

Upgrade Ubuntu

To upgrade Ubuntu you’ll basically need to run 3 commands.

  1. sudo apt update
  2. sudo apt upgrade
  3. sudo apt dist-upgrade

If you want to be a bit more though you can do something like:

sudo apt update 
sudo apt upgrade 
sudo apt full-upgrade 
sudo apt dist-upgrade 
sudo apt-get check 
sudo apt -f install 
sudo apt -y clean 
sudo apt -y autoclean 
sudo apt autoremove 
sudo dpkg --configure -a 
sudo apt --fix-broken install

but usually, the first 3 commands would do the trick.

Now, before you begin, I’ll recommend to create a Snapshot of your Droplet just to be sure you have everything backed in case of an emergency.

You can see the docs here:

https://docs.digitalocean.com/products/images/snapshots/

Snapshots are on-demand disk images of DigitalOcean Droplets and volumes saved to your account. Use them to create new Droplets and volumes with the same contents.

Migrate to a new Droplet

The other option would be to migrate your application on a newly created Droplet which has Ubuntu 22.04.

The first step is to create and configure your Droplet to be ready for your website. This process can be difficult for people with no experience. As such I’ll recommend using the DigitalOcean market place :

https://marketplace.digitalocean.com/apps/wordpress

There is a WordPress image. This will create a Droplet ready for use exactly for a WordPress website. Follow the steps there and you’ll be good to go.

Now that you have a second upgraded Droplet, it’s time to migrate the data, you can use plugins like:

https://wordpress.org/plugins/all-in-one-wp-migration/

It should move your data all in one go. The final step will be to test everything with a host file and make sure it is working fine and then switch the DNS settings and push your site live from DigitalOcean.

This is the first part

As a comment, I’ll post point number 2 and 3

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel