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?

6 Answers 6


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.

  • 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.


The accepted answer on this page addresses the primary reason you would see a Service Temporarily Unavailable page.

However if you only see the error intermittently, and specifically if it's after the browser makes multiple simultaneous requests to a server that's configured to use Redis for session storage, your error may be related to the Redis max_concurrency setting.

I've run into this error on a couple of Magento 2 projects and have had to increase the max_concurrency to avoid the error.


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 .


Just Disable maintenance mode as follows

bin/magento maintenance:disable


503 (Service Unavailable) errors accessing Magento software in a web browser is shown due to the "cache problem". Here is a possible solution that works for me. 1: Login admin panel and clear cache and also cache flush 2: If you are not able to login then run this command in CLI "bin/magento cache:clean" & "bin/magento cache:flush". 3: Reindex Indexer with root dir "bin/magento indexer:reindex"

I hope it works for this error 503.

  • This is not true. A general concept is when you see a service related error, this is related to backend code / server config / db config and not frontend code which we can be fixed using cache clean or flash command. Also you won't be able to login if it gives 503 error.
    – amitshree
    Commented May 17, 2020 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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