Troubleshooting a single site's connection

 

Overview

This article describes the most common errors you may see on your website along with troubleshooting solutions to help you resolve them.

Background

Many issues can affect your site's performance. They can range from problems with your database to compromised code, misconfigurations, and hitting memory limits, which causes your processes to be killed (shared servers only). To uncover the root cause, you must troubleshoot various aspects of your website and server configuration.

Error logs

Make sure you always view your site's error.log file when you encounter an error, as this usually gives you an idea of the cause and how to proceed.

400 errors

403 Forbidden Error

The following issues are the most common causes of the 403 Forbidden error.

Directory and file permissions

Directory and file permissions control what access is granted by the webserver.  The following are the default permissions for directories and files:

  • Directories: 755
  • Files: 644

Log into your server via FTP or SSH to check these permissions. If they need to be changed, see this article for instructions on updating permissions.

.htaccess rules

If permissions look fine, but you're still getting a 403 error, proceed with the following steps:

  1. Log into your server and edit the file via FTP or SSH (this example uses SSH).
  2. Rename the .htaccess file from .htaccess to .htaccess_OFF:
    [server]$ mv .htaccess .htaccess_OFF
    
  3. Reload your site. If the 403 error is gone, proceed with these steps.
  4. Open your .htaccess file and comment out any lines starting with deny by putting a # before the line and saving the file.
  5. Rename the .htaccess file you disabled above:
    [server]$ mv .htaccess_OFF .htaccess
    

If the site now loads, you have discovered the lines causing the issue and can resolve them as needed.

Keep in mind that .htaccess rules apply to all subdirectories – so it's possible for an .htaccess file outside of your site's web directory to affect your site. Make sure you also look deeper into the directory structure for .htaccess files that might be the cause.

404 Error

This often happens with sites that use software such as WordPress. In these cases, the software creates rules to rewrite URLs to make them easier to work with. However, if those rules are removed or changed a 404 appears.

For WordPress specifically, this can often be fixed by just resaving your permalink structure. To do this, log into your admin panel, go to Settings > Permalinks, and then click the Save Changes button.

The easiest way to fix this is to download a fresh copy of the software you're using from its website. If the software uses an .htaccess file by default, make sure to copy its contents and paste it into your existing one. If this doesn't resolve the issue, contact support for assistance.

500 errors

500 Internal Server Error (immediate)

The following are the most common causes of 500 errors.

.htaccess issues

If the error happens instantaneously, then most likely, the cause has something to do with your site's .htaccess file. Some potential things to look for:

  • Syntax errors in the .htaccess file
  • Custom PHP setup that isn't working

Try renaming the .htaccess file in your site's home directory to something like .htaccess_OFF (as described above). If the problem is in your .htaccess file, that will immediately solve the problem.

Hitting memory limits

If you're on a shared server, your processes may have been killed due to exceeding your user's memory limit. See these articles for a list of several tools you can use to investigate your running processes and memory usage.

500 Internal Server Error (after the site tried to load)

This can be caused by a few different things.

PHP timing out

If this happens on the admin page

If this only happens on the admin login page, create a custom phprc for your site and adjust the max_execution_time setting to see if this resolves the issue.

If this happens to all of your pages

Check your site error logs to see if there are any helpful error messages.

522 connection timed out error

The 522 connection timed-out error only appears on Cloudflare-enabled domains when Cloudflare times out contacting the origin web server. See this article for information on how to troubleshoot a 522 error.

Website loading errors

The site spins while loading forever

Most often, this means that something is causing your PHP processes to hang. To troubleshoot, log into your server via SSH and run the top-c command. You might notice <defunct> showing up next to some of those processes. This can be caused by a large number of things that must be looked into further in combination with anything you may find in your site's error.log file.

WordPress sites

This often has to do with database tables having overhead or third-party add-ons. See the following articles for ways to optimize your WordPress site to avoid these issues:

Blank page displays

This issue is most often related to either a WordPress theme having problems or a caching plugin behaving improperly. See this article for details.

Additionally, view your site's error.log and WordPress debug log to troubleshoot further. 

Database connection error

View this article for information on how to troubleshoot a database connection error.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?