Problem: Service Temporarily Unavailable is showing on every page of my website after upgrade or adding an extension:
Solution:
Magento 2 maintenance mode file has the .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 or file/permissions/ownership errors.
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 .
DEC
2018
About the Author:
Francis Horan is the owner of Digital Domain Website Solutions and has been designing and developing Flash, CMS and eCommerce websites since the mid 90's. He's involved in all areas of digital design and development including web design, web development, graphic design, animation, video editing, projected visuals, music production and djing. Skills include PHP, HTML5, CSS3, jQuery, Javascript, Flash, SQL and XML. Francis has designed and developed websites for many clients including Kartel, Guinness, Cash & Carry Kitchens, Markettown, Premier Publishing, Independent Newspapers, Groupon, Bwear, Exclusive Audio, The Leeson Hotel and Leeson Business Centres to name a few.