In this tutorial we will show you how to fix 503 service unavailable error in WordPress, on a Linux based virtual private server. If you encountered 503 service unavailable error in WordPress follow the steps below to investigate it and fix the problem. The 503 service unavailable error has a lot of potential causes. To be able to fix the 503 service unavailable error in WordPress, you will have to identify the root cause of the problem. First, make sure that you have SSH or FTP access to the server, and you are able to modify the WordPress files. Connect to your Linux server and follow the instructions below.

Enable debugging in WordPress

The first thing you need to do is to enable debugging in WordPress. It is a really simple procedure which will help you to quickly identify if there is a specific reason why you are seeing this 503 service unavailable error. To enable debug in WordPress, navigate to the document root where you have WordPress installed and open the wp-config.php file. If you are using SSH, you can use the following commands to navigate to the WordPress document root and open the file:

cd /var/www/html/wordpress
nano wp-config.php

Make sure you are using the correct location to your WordPress installation instead of /var/www/html/wordpress in the previous command. Once you open the file for editing, locate the following line:

define('WP_DEBUG', false);

and replace it with the following code:

 // Enable WP_DEBUG mode
define( 'WP_DEBUG', true );

// Enable Debug logging to the /wp-content/debug.log file
define( 'WP_DEBUG_LOG', true );

// Disable display of errors and warnings 
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );

Save and close the file. Now, you can watch the /wp-content/debug.log log file for errors and see what causes the problem with your WordPress website.

Disable the Plugins in WordPress

If enabling debug in WordPress doesn’t help you to identify the root cause of the problem, the next step is to disable the WordPress plugins. This will help you to understand whether the problem is caused by some specific WordPress plugin. You can disable all WordPress plugins at once, or disable them one by one. In most of the times when you encounter 503 service unavailable error in WordPress you will not have access to the dashboard, so you will have to disable the plugins via SSH or FTP.

Basically, to disable a specific plugin you have to rename the plugin directory. Navigate to the WordPress document root and use the mv command to rename a specific plugin. The following example shows you how to disable the WordFence security plugin:

mv wp-content/plugins/wordfence wp-content/plugins/wordfence.disabled

Alternatively, to disable all your WordPress plugins at once you can just rename the pluginsdirectory:

mv wp-content/plugins wp-content/plugins.disabled

Now refresh the site and see if the 503 service unavailable error is gone. If you find that the problem is caused by specific plugin, you can deactivate and reinstall the plugin. Make sure that you have the latest version of that plugin installed.

Disable the Activated Theme in WordPress

Sometimes, the 503 service unavailable error in WordPress can be caused by a problem with the theme you are using. To investigate whether the theme is the one causing the problem you can simply disable it via SSH or FTP. Log in to your WordPress VPS and rename the theme directory. Once you rename the theme directory, WordPress will automatically activate the default twentyseventeen theme, of course if it is installed for your WordPress website.

mv wp-content/themes/theme-name wp-content/themes/theme-name.disabled

Replace theme-name with the name of the theme you are using in the previous command.

If the problem is caused by the theme, you can check if there is a new version of the theme and proceed with an upgrade. If that doesn’t fix the problem, you can contact the theme developer for further instructions or you can use a different theme.

If none of the solutions above doesn’t help, you may contact your Linux VPS hosting provider to help you investigate this further.