A 503 status code reveals an issue that typically appears when the site’s server is not reachable. The 2 main reasons are that the server is down for maintenance or that is overloaded.
What is a 503 HTTP error code?
The Internet Engineering Task Force (IETF) defines the 503 Service Unavailable as:
The 503 (Service Unavailable) status code indicates that *the server is currently unable to handle the request due to a temporary overload or scheduled maintenance*, which will likely be alleviated after some delay. The server MAY send a Retry-After header field (Section 7.1.3) to suggest an appropriate amount of time for the client to wait before retrying the request.
Lack of server resources
The server has reached its full CPU capacity and is throttling, becoming unable to run the website or API. It might be a good idea to setup server monitoring, such as Netdata, which is free!
The surest way to fix a 503 error is to increase your server's capacity. You can do this by upgrading your hosting plan, or if you have a virtual server, you will have to upgrade the machine itself. This can be done easily with one click in your web hosting dashboard.
Shared server machine
Most of the time, these errors are occasional, mostly due to hardware errors on the server side, like a false positive. In a lot of providers, such as DigitalOcean, GoDaddy or Hostinger, your website are hosted on virtual machines that share resources from the same physical server. Other users using a lot of the machine's resource could potentially cause your website a 503 HTTP error. Generally due by a peak of traffic from users, or periodic jobs processing heavy loads, such as database backups. To avoid risking such issue, it is recommended to use bare-metal servers, which are physical servers dedicated to a single tenant.
Another way to increase your server resources is through caching - this method makes it easier for users to quickly access files on your site because they take up less space on the server. This has the added bonus of lowering bandwidth costs and increasing website speed and performance for users (and thus increasing conversions). To implement caching, there are either software solutions like W3 Total Cache and WP Super Cache or services which will cache pages for you like CloudFlare or Akamai.
Your application has crashed
Your application may have crashed. Check the event viewer and see if you can find event logs in your Application/System log, then try restarting your server application.
The service is down for maintenance
Most web servers shut down during maintenance. If you can access your server's administration settings, check the configuration options to see when automatic maintenance sessions are scheduled. You can also disable these automatic updates in the configuration options if you would rather have complete control over your server's maintenance schedule.
The website you're trying to reach is probably handling a status page, where they share real time updates about their ongoing issues and maintenance updates.
Wordpress related 503s
WordPress powers more than 30% of web servers, making it the most popular CMS on the internet. If you're running a WordPress site, then you know how frustrating server issues can be. One of the most common errors is HTTP Error 503 Service Unavailable. Fortunately, there are many easy fixes for this error. Here are some ways to fix the HTTP Error 503 Service Unavailable in WordPress so your site stays up and running 24/7. Solutions listed above could help solve your 503 HTTP error, but some issues are specific to Wordpress applications:
Misconfigured web apps may also cause a 503 error to appear, such as a plugin conflict caused by WordPress. The 503 service unavailable error occurs when your web server is unable to get a proper response from a PHP script. This PHP script could be a WordPress plugin, a theme, or a misbehaving custom code snippet.
Deactivate all Wordpress plugins
Try disabling all Wordpress plugins, see if this solves the issue, then switch them back on one by one to pin-point which one was causing your website an error.
One simple method is emptying your Plugins folder to a another temporary folder. Then proceed by moving plugins one by one to your Plugins folder, until you face the error again. You could either re-install the plugin that was causing the error, find an alternative plugin, or see the next solution.
Update or revert Wordpress's PHP versions or your plugins or theme
You might encounter a 503 Service Unavailable after your updated your plugins. She of the newer plugins don’t work as well with older versions of PHP. Log-in to CPANEL and change back the PHP version to a lower version.
Another solution would be to uninstall your theme to reinstall it with its latest version.
If these methods fail to resolve the error, then try contacting your hosting provider.
Increase WP Memory Limit
You need to paste this code in wp-config.php file just before the line that says 'That’s all, stop editing! Happy blogging.'
define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
Once you are done, you need to save your changes and upload your wp-config.php file back to your server.
Before you do a clean install, try disabling your SSL settings in your hosting or plugins.
Change your hosting provider
If you're facing too many 503 HTTP error codes, try changing your hosting provider to one more reliable. GoDaddy, Hostinger or BlueHost are great alternatives.
How to prevent 503 HTTP errors from happening?
Most 503 HTTP error codes could go unnoticed, as you're not browsing your site 24/7.
A great way to monitor these errors is to use an Uptime Monitoring service. They will ping your Wordpress site every 30 seconds, and will send you alerts via email, SMS or Slack, and show you reports when facing 503 HTTP error codes, or any other issues. This way you'll stay aware of any problems your Wordpress sites might encounter, and you'll be able to react faster.