In this tutorial you’ll learn different Magento 2 Modes.
Earlier, Magento 1 was operated with a single mode for development as well as production. However, the Magento 2 came with below modes.
Magento 2 Modes : Default, Developer Production and Maintenance.
Let’s review through each of them in detail.
(01) Default : As the name suggests, the default mode is when no other mode is specified. In the default mode, you can deploy the Magento application on a single server without any changes in the settings.
When you initially launch a Magento 2 site it is typically in Default mode.
This mode is a hybrid of Developer and Production and appears to be intended to ramp up the time-to-launch for base Magento 2 sites due to the ability to develop without compiling code as well as a standardized set of configurations.
(03) Production : All live Magento 2 sites should be in Production mode. This mode utilizes full page caching alongside a fully built pub folder to pull from, and is optimized to run smoothly and efficiently leading to the greatest customer experience. Debugging is more difficult in Production mode as they are logged at the server level and not displayed to the user on the frontend.
Production mode is more secure than Default or Developer mode as well due to the fact that there is no symlink created for the pub/static folder. This means if a malicious user were to gain access to pub/static and make changes they would only be changing duplicate versions of those files which would be overwritten during the next static deploy.
(04) Maintenance : Intended to prevent access to a Magento Commerce site while it is being updated or reconfigured.
How to check which Magento 2 mode is used in your store?
Run the below command:
php bin/magento deploy:mode:show
Set Magento 2 Default Mode:
Run the below command:
php bin/magento deploy:mode:set default
Set Magento 2 Developer Mode:
Run the below command:
php bin/magento deploy:mode:set developer
Set Magento 2 Production Mode:
Run the below command:
php bin/magento deploy:mode:set production
Enable Magento 2 Maintenance Mode:
Run the below command:
php bin/magento maintenance:enable
Enable Magento 2 Maintenance Mode with specific ip:
Run the below command:
php bin/magento maintenance:enable --ip=127.0.0.0 --ip=127.0.0.1
Disable Magento 2 Maintenance Mode:
Run the below command:
php bin/magento maintenance:disable
Magento 2 Maintenance Mode Status:
Run the below command:
php bin/magento maintenance:status
🙂 Happy Coding. Keep Liking & Sharing 💻
DevDocs Home