The reason why you've landed on this page is the Service Temporarily Unavailable Magento 2 error that appeared when you tried to access your admin or storefront. 

Any errors that appear on your Magento 2 store can cost you not only time but money. So eliminating it as quickly as possible is a top priority.

503 Service Temporarily Unavailable Magento 2

For those who face this error or want to be prepared beforehand, we're going to provide a quick guide. 

Why Magento 2 Service Temporarily Unavailable Error Appears?

Error 503 Service Temporarily Unavailable Magento 2 is one of the most common Magento 2 errors. It appears when you install Magento 2 extension, or try to set up your Magento 2 store or update Magento. 

Service Temporarily Unavailable error is usually followed by the messages like: 

The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

The server is temporarily unable to handle the request.

This gives us everything we need to understand the reasons behind this message:

  • server can't handle a request instantly
  • server might be misconfigured
  • maintenance mode is enabled

All these may trigger the 503 error in Magento. However, there is more to this.

Maintenance Mode Enabled in Magento 2

Usually, the system creates .maintenance. flag to display the Service Temporary Unavailable message while the installation is processed. It helps to avoid confusion for customers who might see broken page blocks and other elements affected by the process.

Then, once the installation or update is finished, the system deletes the file automatically.

Have you guessed where this is going?

The Magento 2 Service Temporarily Unavailable error appears in case .maintenance. flag t is not deleted for some reason.

How to fix Magento Service Temporarily Unavailable?

Now, that you know the reason for Service Temporary Unavailable error appearing, you can fix it just in a few steps.

To fix 503 Service Temporarily Unavailable Magento 2 error:

  1. Go to the Magento 2 root directory and delete the .maintenance.flag file in the var folder.
  2. Clean Magento cache from admin panel or by running this command:
 php bin/magento cache:flush

Also, once you delete the file in question, you might see the following messages:

Exception printing is disabled by default for security reasons — to fix it, enable the developer mode to see the code of the issue. Use this command to enable developers mode:

php bin/magento deploy:mode:set developer

Please upgrade your database — to fix it, go to Magento root directory and run:

php bin/magento setup:upgrade

That should do the trick and you will be able to fix the Service Temporarily Unavailable Magento 2 error. If you get stuck in the process, just leave a commend below and we'll figure it out together.