503 - an error that you might have encountered while installing the store or the server. In Magento, this error basically means that the server isn't available at the instant. It happens either because the server is under maintenance mode or just because it's busy.
The Reason Behind this Error
During Magento 2 installation, it creates maintenance.flag file to show the system message till the operation finishes the performance. It helps to hide the screen from users in case of errors or issues when the process is going on. This system message should be removed once the operation is completed. But sometimes this file isn't deleted automatically post the operation is completed and therefore it shows Service Temporary Unavailable error even after the process is completed.
How to Fix the Service Temporary Unavailable error?
Follow these steps to fix the service temporarily unavailable error:
Navigate to the root folder of Magento 2 and find out the .maintenance. flag file in the var folder. Usually, this is the file that is automatically removed after the installation process. But due to some error, the deletion of this file is skipped causing problems such as 503.
Disable the Maintenance Mode:
- Navigate to the Magento root folder to delete the file var/.maintenance.flag
- Refresh Magento 2 cache from php bin/magento cache:flush or via the Admin Panel
- Check the error log if you see a message saying “Exception printing is disabled by default for security reasons.”
- In case of an error like “Please Upgrade your database”, run php bin/magento setup:upgrade from the root directory.
Note: The maintenance mode file differs for Magento 1 from Magento 2.
- Magento 1.x: Delete maintenance.flag file from Magento root folder
- Magento 2.x: Delete .maintenance.flag file from the folder [Magento root folder]/var
Get rid of the error 503 and fix the Magento 2 Service Temporarily Unavailable easily!
Now that your store is error-free, allow your customers to continue shopping without any hindrance. Still, if you face any issues, feel free to reach us out.