Are you looking to enable Magento 2 maintenance mode?
Maintenance mode is helpful during website maintenance. It shows a user-friendly notice to the website visitors that your website is under maintenance instead of a broken page.
It also allows developers and Magento owners to deploy any update, patch, or changes to the Magento store while keeping it away from the live visitors.
This quick tutorial will show you how you can put your Magento site in maintenance mode.
What to do before enabling Magento 2 Maintenance Mode?
Turning the maintenance mode ON without preparation is not a smart move.
Enabling maintenance mode will make the site inaccessible to the number of users, and they will not be able to understand why the site goes under maintenance and how long it will be in the maintenance.
Some of the measures you should take care of before moving to maintenance mode.
- Notify the subscribers that your website will go to maintenance in advance. Many eCommerce stores send an email or show a message on their site showing the time and date of maintenance.
- Taking the entire backup. You should always take the complete backup before making any significant changes to the site.
- Exclude the pages that are critical from the maintenance mode. Such as support pages, KB, login pages, — keep them live while the website is in maintenance mode.
Enabling maintenance mode in Magento 2 with CLI

Follow these steps to enable maintenance mode in Magento 2:
- Enable the Magento command-line interface (CLI)
- Log in to your account via SSH.
- Go to the directory where the Magento is installed. Use the below code:
cd ~/public_html
- Add the IP address you want to permit access to the Magento store. Use the below command:
bin/magento maintenance:allow-ips xxx.xxx.xxx.xxx
Change the xxx.xxx.xxx.xxx with IP address. Find your IP address.
- Enable the Magento maintenance mode with the following command
bin/magento maintenance:enable
The command will put the Magento 2 store in maintenance mode. Only the IP address you allowed will be able to access the store. All other users and visitors will see a page notifying them that the store is under maintenance.
- Disabling the maintenance mode will open the store for everyone again. Use the following command:
bin/magento maintenance:disable
- You can check the maintenance mode status any time with the following command:
bin/magento maintenance:status
Wrap Up
Thatβs it.
Copy-paste the commands to enable/disable the Magento 2 maintenance mode.
If this tutorial helped you, you would love our Breeze panel. Subscribe to the blog to get updates.