Magento 2 Enable or Disable maintenance mode via Command Line

In this tutorial, we will talk about Enable Magento 2 maintenance mode via Command Line in Command Line Series. As you know, from Magento 2, they add many commands in bin/magento. This may difficult to get approach this , let me explain more detail about it.

Custom Maintenance Page with FREE extension

Check maintenance mode Status in Magento 2

 php bin/magento maintenance:status

Result:

Status: maintenance mode is not active
List of exempt IP-addresses: 123.123.123.123

Enable Magento 2 Maintenance Mode via command line

php bin/magento maintenance:enable

Result:

$ php bin/magento maintenance:enable
Enabled maintenance mode

Disable Magento 2 maintenance mode via command line

php bin/magento maintenance:disable

Allow IPs to access to the store

Sets maintenance mode exempt IPs

php bin/magento maintenance:allow-ips

E.g:

php bin/magento maintenance:allow-ips 168.168.168.168
Set exempt IP-addresses: 168.168.168.168

Custom Maintenance Page with FREE extension

Enjoyed the tutorial? Spread it to your friends!

magento-2-module-development
command
line
cli
console
indexer
reindex

Sam Thomas
Sam Thomas

CEO and Founder of Mageplaza. Pursueing a simple and healthy lifestyle. A friend, a husband and a dad of two children, a trainer and a wanna-be influencer. He is a big fan of sports and travel, also.