4

In Magento 1 when there is a 503 error,[.maintenance.flag] file gets created in root Magento directory and deleting it brings the website back to its normal stage.

In Magento 2 when there is a 503 error, [.maintenance.flag] is neither present in root nor in var. Where it's present?

8

Magento 2 maintenance mode file has the name .maintenance.flag (with the leading dot) and is located in the var folder.
But HTTP 503 code response can have different causes. For example, the cause could be a webserver misconfiguration.

5
  • Delete the file called .maintenance.flag located in the var folder.
  • If appear Exception printing is disabled by default for security reasons, please check the error log.
  • If the error log prompts Please upgrade your database, run:

php bin/magento setup:upgrade

from the Magento root directory.

0

In lots of cases, after installing a new extension and recompiling Magento 2 code, you need to set file and folder permissions again.

After running these commands through SSH:

php bin/magento setup:upgrade

php bin/magento setup:di:compile

You then need to reset the file permissions and reset file ownership by running these commands through SSH:

find . -type f -exec chmod 644 {} \; // 644 permission for files

find . -type d -exec chmod 755 {} \; // 755 permission for directory

find ./var -type d -exec chmod 777 {} \; // 777 permission for var folder

find ./pub/media -type d -exec chmod 777 {} \;

find ./pub/static -type d -exec chmod 777 {} \;

chmod 777 ./app/etc

chmod 644 ./app/etc/*.xml

chown -R 10000:1004 .

chmod u+x bin/magento

That should fix the "Service Temporarily Unavailable" issues.

Sometimes you might need to run this command more than once:

chown -R 10000:1004 .

0

Just Disable maintenance mode as follows

bin/magento maintenance:disable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.