Follow this guide step by step with ChatGPT, Claude or another AI

Updated: 30 November 2026 · Applies to: Magento Open Source and Adobe Commerce 2.4 (commands from Adobe documentation; file commands tested on Ubuntu 24.04)

To put a Magento 2 store into maintenance mode, run bin/magento maintenance:enable from the Magento root folder, and run bin/magento maintenance:disable to bring it back. Add --ip=YOUR.IP so you can still see the store while visitors get the maintenance page. Magento decides only by whether the file var/.maintenance.flag exists, so editing the text inside that file does nothing: create it to switch maintenance on, delete it to switch it off.

What maintenance mode does

According to Adobe, when var/.maintenance.flag exists, Magento shows a 503 maintenance page to visitors. If var/.maintenance.ip also exists and the visitor's IP address is listed in it, that visitor sees the normal store. Exempt your own IP before you start, so you can keep checking the store while you work.

Method 1: Use the Magento command line (recommended)

Connect to the server over SSH, change to the folder where Magento is installed (the one that contains bin/magento), and run the commands as the user that owns the Magento files. Adobe states that all Magento CLI commands must be run by the file system owner, not as root, or Magento creates files the web server cannot read.

  1. Find your public IP address, for example with the "What is my IP" tools in your browser, or from your router.
  2. Switch maintenance mode on and exempt your IP address (replace the example address with yours):
    bin/magento maintenance:enable --ip=203.0.113.10
    To exempt more than one address, repeat the option:
    bin/magento maintenance:enable --ip=203.0.113.10 --ip=198.51.100.25
  3. Check the current state and the exempt list:
    bin/magento maintenance:status
  4. Do your work. If the store uses message queue consumers, Adobe recommends stopping them while maintenance mode is on. List them with:
    ps -ef | grep queue:consumers:start
    and stop each one with kill followed by its process ID. On a store with several web nodes, repeat this on every node.
  5. Switch maintenance mode off:
    bin/magento maintenance:disable

Change the exempt IP list without toggling maintenance mode

According to Adobe, maintenance:allow-ips sets the exempt list on its own:

bin/magento maintenance:allow-ips 203.0.113.10 198.51.100.25

To clear the list so that nobody is exempt:

bin/magento maintenance:allow-ips --none

When you run maintenance:disable with --ip, Adobe notes that the addresses are saved for the next time you enable maintenance mode. Use --none when you want that list gone.

Method 2: Create or delete the flag file (no SSH command line needed)

If you only have a file manager (for example cPanel File Manager) or SFTP, you can do the same thing by hand. There are no commands to type inside the file: an empty file is enough.

  1. Open the Magento root folder and then its var folder.
  2. Create an empty file named .maintenance.flag in var. Maintenance mode is now on. Over SSH, the same step is:
    touch var/.maintenance.flag
  3. To exempt your own address, create var/.maintenance.ip containing your IP addresses separated by commas, with no spaces (this is the format Magento itself writes):
    203.0.113.10,198.51.100.25
  4. To switch maintenance mode off, delete var/.maintenance.flag. You can leave var/.maintenance.ip in place for next time.
    rm var/.maintenance.flag

Hidden files start with a dot, so turn on "Show hidden files" in your file manager if you cannot see them. If you create the files over SSH as root, set their owner to the Magento file owner afterwards (for example chown deploy:deploy var/.maintenance.*), so Magento can delete them later.

Common mistakes

  • Changing "enable" to "disable" inside the flag file. Magento never reads the contents of .maintenance.flag; it only checks whether the file exists. Delete the file or run bin/magento maintenance:disable.
  • Forgetting to exempt your own IP. Without it you see the same 503 page as everyone else and cannot check your work. Add your address with --ip or maintenance:allow-ips.
  • Your IP changed. Mobile and home connections can change address. Run bin/magento maintenance:status and update the list if you suddenly see the maintenance page.
  • The store sits behind a proxy or CDN. Magento then sees the proxy's address instead of yours, so your exempt IP may not match. Test from a private browser window after enabling.
  • Running the command as root. Run it as the file owner, for example sudo -u deploy bin/magento maintenance:enable, where deploy is the user that owns the Magento folder.

Custom maintenance page

The page visitors see comes from pub/errors/default/503.phtml. Adobe describes copying it, with pub/errors/default/css/styles.css, into your own folder under pub/errors/ to brand it. Keep your copy outside default, because upgrades can replace the default files.

Related articles

If you would rather have an engineer do the update work while the store is in maintenance mode, our Hire an Expert team can help by the hour.

Official documentation: Adobe Commerce: Enable or disable maintenance mode

Was this answer helpful?

Still stuck? Open a ticket