X
    Categories: Knowledgebase

Magento 2 Maintenance Mode | Enable maintenance mode in Magento 2

How to activate Magento 2 maintenance mode

This article will guide you how you can enable maintenance mode in Magento. When Magento is in maintenance mode, visitors will see the message “Service Temporarily Unavailable” in their web browsers instead of the store. However, authorized IP addresses can still view normal stores.

Message “Service Temporarily Unavailable” when activate Magento 2 Maintenance Mode

This feature allows you to develop and test your store before it works again or performs other maintenance tasks, such as installing updates.

To enable maintenance mode in Magento 2, follow these steps:

1. If you have not already done so, enable the Magento command-line interface (CLI). For information about how to do this, please see this article.

2. Log in to your account using SSH.

3. At the command prompt, type the following command:

cd ~/public_html

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

4. To allow 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 you want to allow access to:

bin/magento maintenance:allow-ips xxx.xxx.xxx.xxx

If you do not know your own IP address, you can visit http://ipfinder.us.

5. To enable maintenance mode, type the following command:

bin/magento maintenance:enable

Maintenance mode is now enabled. When you access Magento from an authorized IP address, the store will display normally. All other visitors will receive a temporary service message Not available in their web browsers.

6. 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

I have guide how to enable maintenance mode in Magento. If you have any questions, please comment and I will help you . Thanks

Cao Hồng Quang: