Magento 2.x. How to Enable the Site Maintenance Mode

This short guide will help you to find out how to manage Maintenance mode in Magento 2.x themes.

➤ There are 2 easy ways to enable Maintenance mode, the first one includes an SSH command (run the command in your root directory).

Method 1

First, connect to your server via SSH and navigate to your Magento root installation folder.

Now, run the following command to enable simple maintenance mode:

After the command is executed, the mode will be set.

However, if you want to allow access via specific IPs, you can run the following command instead:

To grant access to several IPs, just use the option multiple times:

Method 2

Alternatively, you can just create .maintenance.flag file in the “var” folder.

It will put your store under the maintenance mode too.

Feel free to check the Magento 2 guidance book for more information.