Bobcares

How to fix ‘503 service unavailable error’ in your websites

by | Mar 24, 2018

In our role as Server administration specialists for server owners, website errors are a commonly encountered issue that we resolve for them.

‘503 service unavailable error’ is one such website error. Recently, we were contacted by a Docker hosting provider who was getting this error in his website.

503-service-unavailable

 

There were multiple sites hosted in the Docker machine, but the 503 error was seen in the backend of only one website.

Whenever the site traffic went high, that was when the ‘service unavailable error’ was noticed.

The site began to slow down. Customer feared that visitors would start abandoning the site, and business would get affected. That’s when he contacted us for assistance.

Needless to say, it was an Emergency situation, and we started working on it through our priority channel : Emergency Support Services.

Today, we’ll see the various solutions we considered, and how you can fix this error if you come across similar situations.

What is “503 service unavailable error”?

A “503 service unavailable error” is an indication that the web server is unable to handle the request temporarily. It can lead to the website being unavailable to the visitors at that time.

The client who consulted us, was offering Docker hosting, and each container hosted a WordPress site. It was one such WordPress site that was giving the error in backend.

While other errors have clear cut reason, 503 error is often an ambiguous one. Many reasons – server wide or site specific – can cause this “service unavailable error”.

What causes “503 service unavailable error”

Anything from an overloaded server to a buggy plugin, can cause a WordPress site to be unavailable. Some of the various reasons we’ve come across in our debugging experience, are:

1. Inadequate server resources

In a shared hosting environment where multiple websites are hosted, server owners often try to achieve high account density, to ensure maximum gains.

Server resources such as memory, CPU, I/O, disk, etc. would be divided among multiple websites hosted in the server. In a docker machine, each container would be allotted a set of limited resources.

When the resources allocated to a container or an account is not enough for its normal functioning, the website hosted in it can give intermittent errors due to this resource shortage.

2. Web server misconfiguration

By default, all web servers come with a common configuration. Many server owners leave this default setting as it is, and build their hosting upon it.

While the default settings may work fine for low density and low traffic web servers, it may not be the optimal setting to handle an increase in the traffic and website count.

If the web server configuration settings (such as connection counts, memory limits, etc.), are not fine-tuned in the server, it can cause “service unavailable error”.

3. High web traffic due to attacks

The access to a website can vary from time to time. A peak sale time or a business growth can pull in valid traffic to a website, which may not have been foreseen by the customer.

But many a time, the web traffic spikes due to attacks or bots or others hack attempts to the site. For instance, a contact form in the site can be abused by attackers to generate a traffic spike.

As most attacks are often intended at causing downtime to the websites by draining out the server or the container resources, such high traffic often leads to “service unavailable error”.

4. Buggy applications or server software

Software applications such as WordPress are often accompanied by a huge set of plugins which website owners install for various features. Not to mention the code customisation and redirects done.

If any code or plugin has a bug or improper setting that can hog down the server resources, the website can crawl and become unavailable to visitors.

Web servers work along with other server software such as database, PHP, etc. If these software are not fine-tuned for optimal performance, they can also be contributing factors for the error.

How to resolve – 503 service unavailable error – in web server

When the customer contacted us complaining about 503 error in his WordPress site, we adopted a step-by-step debugging methodology to resolve the website error.

I. To pinpoint the actual cause of the 503 error, we first examined the web server logs. The location of the web server logs vary based on whether you are using Apache, NginX or IIS web servers.

For Docker, each container has a unique log which records the access details and error messages specific to that container. These logs gave us a hint towards the cause of the error.

II. Next, we examined the resource usage in the server and specific to the website in question. Using custom tools, we monitored the server resources and website statistics.

For websites that give intermittent errors, we debug the issue with the help of tools that retain past records of server resource usage for various time periods.

III. When the resource usage (CPU and memory) for the container was noted to be higher than its allotted values, we dug the access logs further to figure out if the traffic was valid or not.

From our detailed analysis, we could trace out that a particular URL in the WordPress site was being abused by attackers, from different locations around the world.

IV. We then secured the Docker machine with a custom firewall used for cloud servers. After figuring out the abuser IP addresses, we validated the IP addresses and blocked suspicious ones using this firewall.

Further, we reviewed the URL that was under attack, found that it was a contact form, and took actions to protect the website URLs from further attacks.

V. As an additional preventive measure, we scanned the websites in the server for malicious or vulnerable code, and took actions to disable them and protect them from attacks.

We also performed a fine-tuning of the web server configuration, along with the MySQL and PHP settings, to ensure that the web sites are served with the maximum server potential.

After performing these actions, the server load and resource usage for the container returned back to normal and the site started functioning without any errors.

If you are facing a server error, but not sure which configurations to tweak or how to track the attackers, we can help you. Click here to consult a web server expert. We’re online 24/7 and we can assist you in a few minutes.

Conclusion

“503 service unavailable error” is a commonly seen, but confusing web server error. The major hurdle involved in fixing it, is finding the actual root cause of the error. Today we’ve seen various causes for the error and how to resolve it with a steady debugging methodology.

 

NO MORE SERVER ERRORS!

Never again lose customers to website errors! Let us help you.

GET EXPERT ASSISTANCE NOW

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.