Knowledge Base

How to enable maintenance mode in Magento

This article describes how to enable maintenance mode in Magento. When Magento is in maintenance mode, visitors see a Service Temporarily Unavailable message in their web browsers instead of the store. However, authorized IP addresses can still view the store normally.

This feature allows you to develop and test your store before it goes "live," or do other maintenance tasks, such as installing updates.

If you installed Magento 2 in a subdirectory, change to that directory instead. For example, if you installed Magento in a subdirectory named mag2, you would type cd ~/public_html/mag2.

To permit access to the front-end store from a specific IP address while Magento is in maintenance mode, type the following command. Replace xxx.xxx.xxx.xxx with the IP address for which you want to allow access:

Maintenance mode is now enabled. When you visit Magento from an authorized IP address, the store displays normally. All other site visitors, however, receive a Service Temporarily Unavailable message in their web browsers.

To disable maintenance mode and re-enable the store for all visitors, type the following command:

bin/magento maintenance:disable

To view the maintenance mode status at any time, type the following command:

bin/magento maintenance:status

Enabling maintenance mode in Magento 1.9 and older versions

To enable maintenance mode in Magento 1.9 and older versions, follow these steps:

Maintenance mode is now enabled. When you visit Magento from an authorized IP address, the store displays normally. All other site visitors, however, receive a Service Temporarily Unavailable message in their web browsers.

To disable maintenance mode and re-enable the store for all visitors, type the following command: