How to turn Magento 2 Maintenance Mode ON or OFF?
To enable maintenance mode you should create var/.maintenance.ip
file. This file can contain a list of IP addresses. If an entry point is accessed using HTTP and the client IP address corresponds to one of the entries in that list, then maintenance mode is off.
Command usage::
bin/magento maintenance:enable
bin/magento maintenance:disable
To enable maintenance mode for all clients except 192.0.2.10 and 192.0.2.11:
bin/magento maintenance:enable --ip=192.0.2.10 --ip=192.0.2.11
Read more here
In order to put your Magento 2 store in maintenance mode, you need to create one .maintenance.flag
file and upload it under var
folder at root of your Magento 2 installation.
If var/.maintenance.flag
does not exist, Magento operates normally, and maintenance mode is off.
More for information read this post
You can enable disable maintenance mode
and exempt IP-addresses enable disable
for using below command.
Maintenance mode Enable:
php bin/magento maintenance:enable
Maintenance mode Disable:
php bin/magento maintenance:disable
Maintenance mode Enable List of exempt IP-addresses
php bin/magento maintenance:enable --ip=192.0.3.26 --ip=192.0.4.27
Maintenance mode remove List of exempt IP-addresses
php bin/magento maintenance:disable --ip=none
Hope it help!