Guide

Switch Magento 2 to production mode, without breaking the store.

Production mode is faster and hides errors from visitors. Check the current mode, put the store in maintenance, switch, build the code and static files, and open it again. Checked on Nov 5, 2026.

Step 1Check

See which mode the store runs in

Magento has three modes: default, developer and production. Live stores should run in production.

On your server

bin/magento deploy:mode:show

Step 2Switch

Put the store in maintenance

The switch rebuilds generated code and static files, which takes a few minutes. Maintenance mode shows visitors a short page meanwhile. Add your own IP to keep browsing the store.

On your server

bin/magento maintenance:enable --ip=203.0.113.10

Replace 203.0.113.10 with your own public IP address.

Step 3Switch

Switch to production

Skip the build in this step and run it yourself in the next one, so you see each part and its errors.

On your server

bin/magento deploy:mode:set production --skip-compilation

Step 4Build

Compile the code and deploy the static files

Run both, in this order, every time you deploy new code. List every language the store uses in the static deploy.

On your server

bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f en_US pt_PT
bin/magento cache:flush

Run these as the store's Linux user, never as root, so the files keep the right owner.

Step 5Check

Open the store again and check the logs

Leave maintenance, open a few pages, and watch the logs for the next minutes.

On your server

bin/magento maintenance:disable
bin/magento deploy:mode:show
tail -f var/log/exception.log var/log/system.log

Questions, answered.

ShopWhizzy support Magento since 2008

Talk to us
Developer mode builds files on every request and shows full errors. It is meant for development, never for a live store.
After code, module or theme changes in production mode, yes: setup:di:compile, then setup:static-content:deploy, then cache:flush.
Usually a language missing from the static deploy, or files created as root. Deploy every language the store uses, as the store's own user.
Live stores run in production mode, and our deploys build the code and static files before the release switches.

Bring your store over. We move it for free.

Pick a plan, pick a platform, and your store is online before the coffee cools.

Prices include VAT. Server support on every plan.