How to fix Error 503 (Service Temporary Unavailable) in Magento 2
As a Magento user, you might have already faced Error 503 – Service 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.
Table of contents
Check whether you deal with Error 503
First of all, you need to confirm that the issue is not related to the
1 |
Invalid command 'Order', perhaps misspelled or defined by a module not included in the server configuration. |
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:
1 2 |
a2enmod access_compat service <name> restart |
Replace <name> with httpd for CentOS and with apache2 for Ubuntu. For further information, check this article:
According to another StackExchange user
1 |
Exception printing is disabled by default for security reasons |
If you see ‘Please upgrade your database’ in the error log, run the following command from the Magento 2 root directory:
1 |
php bin/magento setup:upgrade |
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.