503 service unavailable error: what it is and how to fix it

     
Errors happen – there"s some unexpected maintenance, a bug that went unnoticed, or a page goes viral và the flood of connections take the VPS down.

Bạn đang xem: 503 service unavailable error: what it is and how to fix it

If you"ve sầu been online for any amount of time, no doubt you"ve sầu seen the somewhat vague 503 Service Unavailable error.

In this article we"ll go over HTTPhường status codes, what the 503 error means, and some possible ways to lớn solve sầu it – both for a site you"re trying lớn visit and for your own site.

An overview of HTTPhường status codes

Servers that host web pages listen for requests from website browsers or devices, also known as clients. The server then uses a bunch of different status codes lớn communicate baông chồng.

These status codes are organized inlớn different classes, which is indicated by the first number of the status code:

1xx: Information – the VPS is still processing the request2xx: Success – the request succeeded and the server responds with the page or resource3xx: Redirection – the page or resource has moved và hệ thống will respond with its new location4xx: Client error – there is an error in the request from the browser or device5xx: Server error – there is an error with the server

The last two digits of each HTTP.. status code represent a more specific status for each class. For example, 301 means that a page or resource has moved permanently, while 302 means the move sầu is temporary.

Chechồng out this page for a danh sách of common HTTP.. status codes & their meaning: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes

Most status codes go by totally unnoticed, which is fine because it means everything is working. It"s only when you get khổng lồ the 4xx-5xx range that you might notice a status code because you"ll see a page like this:

*
A typical 503 error page – Source: Staông chồng Overflow

Now that you have a basic understanding of HTTPhường status codes, let"s dig a bit deeper inkhổng lồ the 503 Service Unavailable error.

What does the 503 error code mean?

As mentioned above, 5xx status codes mean there"s a problem with the VPS itself.

A 503 Service Unavailable error means that the page or resource is unavailable. There are many reasons why a server might return a 503 error, but some common reasons are maintenance, a bug in the server"s code, or a sudden spike in traffic that causes the server to become overwhelmed.

The message that"s sent with the 503 error can vary depending on hệ thống it"s coming from, but here are some of the comtháng ones you"ll see:

- 503 Service Unavailable- 503 Service Temporarily Unavailable- HTTPhường Server Error 503- HTTP Error 503- Error 503 Service Unavailable- The server is temporarily unable to service your request due to lớn maintenance downtime or capacity problems. Please try again later.Source

Whatever the reason for the 503 error, it"s usually temporary – the VPS will restart, traffic will die down, và the issue will resolve sầu itself.

How lớn solve sầu the 503 Status Unavailable error

When trying khổng lồ solve a 503 error, there are two general camps.

The first is where you"re an end user, & you"re trying lớn visit a site that you don"t own. In the second, you own the site, và it"s throwing 503 errors khổng lồ people who are trying to visit.

The method lớn solve sầu 503 errors is different depending on which group you fall into. Let"s take a look at some things you can vì chưng as an kết thúc user if you see a 503 error.

How to lớn solve a 503 Status Unavailable error as an kết thúc user

Since 5xx status codes mean that the error is on the server-side, there isn"t a lot you can do directly.

Even though 503 errors are usually temporary, there are some things you can bởi while you wait.

#1: Refresh the page

Sometimes the error is so temporary that a simple refresh is all it takes. With the page open, just press Ctrl - R on Windows và Linux, or Cmd - R on macOS khổng lồ refresh the page.

#2: See if the page is down for other people

The next thing you can vày is use a service like Is It Down Right Now? or Down For Everyone Or Just Me to see if other people are getting the same error.

Just go to either of those sites & enter in the URL for the page you"re trying to lớn visit.

The service will ping the URL you entered to lớn see if it gets a response. Then it"ll show you some cool stats & graphs about the page:

*
Checking jdomain.vn on Is It Down Right Now?

If you scroll down a bit you"ll see some comments from other people. Often people will give their general location và other data, so this can be a good way lớn determine if the error is just affecting certain regions or specific devices.

#3: Restart your router

Sometimes the issue has khổng lồ vị with a DNS hệ thống failure.

DNS stands for Domain Name System, và they basically act as translators between IP. addresses and human readable URLs.

For example, you can visit Google by entering its long IP address directly (172.217.25.206), or you can just enter in the URL, www.google.com.

It"s a DNS, often hosted on a hệ thống, that handles all that behind the scenes.

Xem thêm: #1 Cách Ẩn Ip Trong Mạng Wifi, 4 Cách Để Ẩn Địa Chỉ Ip Trên Máy Tính Năm 2020

All of that is khổng lồ say, many routers cađậy responses from DNS servers (www.google.com 172.217.25.206). But sometimes this cache can get corrupted và cause errors.

An easy way to reset or "flush" the cađậy is to restart your router. Just unplug your router for about 5 seconds, then plug it bachồng in again.

It should restart after a minute & all of your devices should reconnect automatically. Once they bởi, try visiting the site again.

How to lớn solve a 503 Status Unavailable error as the site"s owner

If you are the owner/developer of the site that"s returning 503 errors, there"s a bit more you can vị lớn diagnose và resolve the issue.

Here are some general tips to lớn get you started:

#1: Restart the server

Development is tough – even a simple static page can have sầu so many moving parts that it can be difficult khổng lồ pin down what"s causing the 503 error.

Sometimes the best thing to bởi vì is khổng lồ restart the hệ thống & see if that fixes the issue.

*
Source: imgflip

The exact method of restarting your hệ thống can vary, but usually you can access it from your provider"s dashboard or by SSH"ing inkhổng lồ the VPS và running a restart command.

The server should restart after a couple of minutes. If you"ve configured everything lớn run automatically on boot, you can visit your site & see if it"s working.

#2: Cheông xã the server logs

The next thing to bởi vì is check the logs.

The location of the VPS logs can vary depending on what service you"re running, but they"re often found in /var/log/....

Take a look around that directory & see if you can find anything. If not, kiểm tra the manual for your programs by running man program_name.

#3: Chechồng if there"s ongoing automated maintenance

Some service providers offer automated package updates and maintenance. Normally this is a good thing – they usually occur during downtime, và help make sure everything is up-to-date.

Occasionally 503 errors are due lớn these scheduled maintenance sessions.

For example, some hosting providers that specialize in WordPress hosting automatically update WPhường whenever there"s a new release. WordPress automatically returns a 503 Service Unavailable error whenever it"s being updated.

Cheông chồng with your service providers to lớn see if the 503 error is being caused by scheduled maintenance.

#4: Cheông chồng your server"s firewall settings

Sometimes 503 Service Unavailable errors are cause by a misconfigured firewall where connections can get through, but fail khổng lồ get bachồng out lớn the client.

Your firewall might also need special settings for a CDoanh Nghiệp, where multiple connections from a small handful of IP.. addresses might be misinterpreted as a DDoS attack.

The exact method of adjusting your firewall"s settings depends on a lot of factors. Take a look at your pipeline và your service provider"s dashboards to see where you can configure the firewall.

#5: Chechồng the code

Bugs, like errors, happen. Try as you might, it"s impossible to lớn catch them all. Occasionally one might slip through & cause a 503 error.

If you"ve sầu tried everything else và your site is still showing a 503 Service Unavailable error, the cause might be somewhere in the code.

Check any server-side code, và pay special attention to lớn anything having lớn vày with regular expressions – a small regex bug is what caused a huge spike in CPU usage, rolling outages, và about three days of panic for us at jdomain.vn.

Hopefully you"ll be able khổng lồ track down the culprit, deploy a fix, & everything will be baông chồng khổng lồ normal.

In summary

That should be everything you need khổng lồ know about 503 Service Unavailable errors. While there"s usually not much you can vì when you see a 503 error, hopefully some of these steps will help the next time you encounter one.


Chuyên mục: Domain Hosting