Why is my WordPress site not loading?

One of the hardest parts of hosting WordPress sites yourself is trying to figure out why a site isn’t loading. There is an array of potential issues that could prevent a site from loading properly. We’re going to look at what causes some of these issues and how you might begin to investigate them.

Server Connection Errors

Say you visit your site and you see an error. You might see a message like “Server Not Found – We can’t connect to the server” or if you’re using Cloudflare, “Error 520: Web server is returning an unknown error”. You might also see a browser error code such as ERR_CONNECTION_TIMED_OUT or ERR_SSL_PROTOCOL_ERROR. These errors can be helpful in pointing you in the right direction but the process of resolving these issues can still be challenging.

If your browser can’t connect to your server there are a few things you should check first:

  1. Your server is turned on and is running.
  2. Your DNS is correctly configured to point to your server
  3. Your firewall is allowing traffic on ports 80 (HTTP) and 443 (HTTPS)

Before we start digging into these issues it’s worth noting that if you’re using Cloudflare proxy (orange cloud) when you ping your domain the IP address might be different due to their security implementation. Also, you’ll get a Cloudflare error response instead of the original error response from your server, which can make the underlying issue harder to investigate. While digging into site issues we recommend you temporarily disable the Cloudflare proxy (grey cloud).

For SpinupWP, your DNS configuration should be an A record pointing to your server’s IP address. You can confirm this by digging your domain name to check it is correctly pointing to your server’s IP address:

dig mydomain.com

Assuming your DNS is correct, next you can verify that your server is returning a response by using cURL on the command line:

curl -I http://mydomain.com

If you see an HTTP response such as “200 OK” then you can connect to your server. If you see a “Failed to connect to mydomain.com” error, then your server is running but it’s likely that Nginx has crashed. You can verify this by SSHing to the server as a sudo user and checking the status of Nginx:

sudo service nginx status

If Nginx is not running, try running sudo nginx -t to verify your Nginx configuration is correct and have a look at the Nginx logs in /var/log/nginx to see what might have caused it to crash. Once you’ve confirmed everything is ok, start Nginx:

sudo service nginx start

Connection Timed Out

If Nginx is running but you get a timeout error it’s likely that a server or network firewall is blocking the connection to the server. You should check that your firewall is allowing traffic on ports 80 (HTTP) and 443 (HTTPS). For example, AWS Lightsail and Google Cloud both deny traffic on one or both of these ports in their firewall by default.

Empty Reply From Server

If you get an “Empty reply from server” error or an “SSL certificate problem: self signed certificate” error, it is likely that the domain’s DNS is configured to point at the server but the Nginx config is missing a server block to handle the domain and the request is being handled by the Nginx catch-all that SpinupWP configures. You should check that your primary and additional domains are correctly configured for your site in SpinupWP. For example, if you have pointed the www subdomain at your server but have not added the www subdomain as an additional domain in SpinupWP you may see this error.

Gateway Timeout

If you see a “504 Gateway Timeout” error, this means that Nginx has timed out waiting for the upstream server (PHP) to respond. This normally happens when PHP has crashed or stopped running for some reason. It can also happen if the PHP max_execution_time is longer than the Nginx fastcgi_read_timeout. You can verify that PHP is running by SSHing to the server as a sudo user and checking the status of PHP-FPM (replace “7.4” here with whatever version of PHP you are running):

sudo service php7.4-fpm status

If PHP-FPM is not running, have a look at the logs in /var/log to see what might have caused it to crash. To start PHP-FPM, run:

sudo service php7.4-fpm start

Forbidden

If you see a “403 Forbidden” error when accessing your site it’s likely that your PHP files don’t have the correct permissions applied. See our File Ownership and Permissions doc for instructions on how to resolve this issue.

Error Establishing a Database Connection

If you see the “Error Establishing a Database Connection” error when trying to access your WordPress site, it’s likely that either your database credentials in your wp-config.php are incorrect or that MySQL has crashed or stopped running for some reason. Once you’ve checked your credentials are correct, you can verify that MySQL is running by SSHing to the server as a sudo user and checking the status of MySQL:

sudo service mysql status

If MySQL is not running, have a look at the logs in /var/log/mysql to see what might have caused it to crash. You should also check the /var/log/syslog file for out of memory errors in case MySQL has been killed by the kernel because of a lack of memory. To start MySQL, run:

sudo service mysql start

Internal Server Error

If you see a “500 Internal Server Error” or you see a blank white page (known as “The White Screen of Death”) when accessing your site, it’s likely that there is something causing a fatal error in PHP. Usually, it’s a plugin or theme that is causing the error. A good place to start investigating this error is to check your site’s debug.log file that can be found in /sites/{domain}/logs. This file should contain any PHP errors triggered during WordPress requests.

Allowed Memory Size Exhausted

If you see an error that looks like “Fatal error: Allowed memory size of XXX bytes exhausted” then PHP has run out of memory while processing the request. By default, PHP is configured with a memory limit of 128MB. However, this can be increased by changing your PHP settings.

Ready to give SpinupWP a try?

Not sure if SpinupWP is the right fit for you? Send us an email at sudo@spinupwp.com and we’ll give you our no-BS opinion.

Subscribe to get the latest news, updates and optimizations in performance and security.

Thanks for subscribing 👍

To receive awesome stuff, you'll need to head to your inbox and click on the verification link we sent you.
Make sure to check your "spam" folder or your "promotions" tab (if you have Gmail).
If you're still having trouble, then messages us at sudo@spinupwp.com.