Service temporarily unavailable: How to solve it in Magento 2?
The HTTP 503 code response is one of the commonest errors you may come across while setting your Magento store or server.
Magento 2 service temporarily unavailable - maintenance mode is enabled
Service Temporarily Unavailable The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
The message may be displayed to users in several cases:
- maintenance mode is enabled;
- server capacity problems;
- server misconfiguration.
In this case, your store is not available at the moment.
The file .maintenance. flag is created in Magento 2 root folder during the installation process. The file is automatically removed after the processing done. However, something can go wrong and the file won’t be deleted or will be created again. Then Magento will define the file and display the message mentioned above to your customers.
Helpful tip: In order to reduce the load on your servers, you can use the Full Page Cache Warmer extension. You will be able to queue pages to refresh the cache and refresh the cache on the most frequently refreshed pages first. This way, your users will always see the most relevant content, and the server will work smoothly. It is one of the ways to increase the speed of the site and improve its user experience.
Disable the maintenance mode
- Go to Magento root folder and delete the file var/.maintenance.flag;
- Fresh Magento 2 cache: php bin/magento cache:flush or via the Admin Panel;
- If you see a message saying Exception printing is disabled by default for security reasons, check the error log;
- If the error log says Please upgrade your database, run php bin/magento setup:upgrade from the root directory.
¡The maintenance mode file in Magento 2 differs from Magento 1 in a leading dot, compare: .maintenance. flag and maintenance. flag!