Question

I want to switch to production mode but I can not find information about the exact commands that I have to use. I know that I must use this command:

php bin/magento deploy:mode:set production

But, do I need to make some change of permission for the folders? Do I need to execute some more command before or after using the command to change to production mode?

UPDATE

These are the commands I use to give permissions to my Magento files and folders:

find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chown -R :www-data .
chmod u+x bin/magento
Was it helpful?

Solution

You can use this command to set production mode:

bin/magento deploy:mode:set production

Note: If you are going to switch from Developer to Production mode two actions must first be taken.

1) Static Deploy (bin/magento setup:static-content:deploy)

2) Compilation (bin/magento setup:di:compile)

OTHER TIPS

You only need to run this command, to switch to production mode

php bin/magento deploy:mode:set production

In case, you get blank screen, You should run

php bin/magento setup:upgrade

then

php bin/magento setup:static-content:deploy

then

php bin/magento indexer:reindex

That's enough!

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top