How to fix Error 503 (Service Temporary Unavailable) in Magento 2

- Fire development, Magento 2

Magento 2 import export debug log

As a Magento user, you might have already faced Error 503Service Temporary Unavailable. If not, here is a brief explanation. When you try to access your admin or storefront in a browser, nothing happens: you get HTTP 503 (Service Unavailable) errors. What to do in this situation? Below, we shed light on how to fix the Service Temporary Unavailable error in Magento 2.

Spoiler: If you know how to deal with it in Magento 1, your skills won’t help you bring Magento 2 back to life, so check this article.

Check whether you deal with Error 503

First of all, you need to confirm that the issue is not related to the maintenance mode. To do so, go to your Apache error.log and look for messages that include the following text:

If it is not the maintenance mode, you have to deal with Error 503. But what are the reasons for the Service Temporary Unavailable issue in Magento 2?

Magento 2 Error 503 nature

The reason Magento 2 users face Error 503 is Apache 2.4. It changes the way certain .htaccess-related directives work. .htaccess is utilized to rewrite URLs in Magento 2. If it doesn’t work properly, you won’t access your store in a browser.

It is also necessary to mention that not all Apache 2.4 distributions cause this issue. There are cases when the mod_access_compat compatibility module is enabled by default. If it is disabled, you have to turn it on.

How to turn on the compatibility module

A user with ‘root’ privileges should enter these commands:

Replace <name> with httpd for CentOS and with apache2 for Ubuntu. For further information, check this article: 503 (Service Unavailable) errors accessing Magento software in a web browser.

How to fix Error 503 (Service Temporary Unavailable) in Magento 2

amitshree faced the Magento 2 Service Temporary Unavailable error and asked for help on StackExchange. While the user was familiar with how to solve the problem in Magento 1 – you have to delete the .maintenance.flag file in the root directory bringing the website back to its normal stage – the resolution for Magento 2 was unclear.

According to another StackExchange user Jeffery, the solution is quite similar: you also have to delete the .maintenance.flag file, but in Magento 2, it is located in the var folder. If the following message appears, check the error log:

If you see ‘Please upgrade your database’ in the error log, run the following command from the Magento 2 root directory:

That’s it! Now, you know how to fix Error 503 (Service Temporary Unavailable) in Magento 2. More useful tips on Magento 2 are available here: Magento 2 Developer’s Cookbook.