Maintenance mode (M2)

Magento 2 can run in one of three primary modes — developer, production, and default.

But aside from that ones there is also a maintenance mode, which is used when you want to make the site unavailable to the public during updates or other changes.

You don’t use the MAGE_MODE variable — instead, you create a flag file:

var/.maintenance.flag

 

to enable the mode (set to default).

The method Bootstrap::assertMaintenance() controls this mode. When maintenance mode is enabled, the screen will show the error message “503 Internal Server Error”.

 

You can specify a group of people to have access to the site while this mode is employed by placing the associated IPs as a comma- separated list (without whitespace) in the file

var/.maintenance.ip.