Error 503 - Service Temporarily Unavailable on Magento Sites

Why we do get this error...?

while installation of the Magento, the Magento will create the “maintenance.flag” Generally it will get removed automatically after the installation of the Magento but sometimes if in case if it was not removed the users will get the error message while opening the sites. The error will look like as mentioned in the below screenshot.

 

One of the main cause for 503 error is when your hosting account starts utilizing all of the available CPU resources. You can also check your resource usage on your server from your User Area. Moreover your server resources can be exceeded due to a traffic spike that is coming to your website and also because of poor optimization of website and database.

 

But today of you are using our server solution then you face any issues related to resource consumption. Because here at HostingRaja we provide best in class server solution with amazing and better resources. Thus you can easily handle and manage your website. And today if you are using cloud server then you also get the advantages of scaling your resource. Hence you will not face any issues with your Magento website.

 

NOTE: The file “maintenance.flag” will create in the root directory.



Magento Service Unavailable

 

SOLUTION:

Once we get this error we feel that it's very difficult to resolve but the solution is very simple. Just we need to rename or remove the file name “maintenance.flag” which was created in the root directory while installation of the Magento hosting service.

 

Then what is “maintenance.flag”.......?

 

Usually the file “maintenance.flag” will consist the code which blocks the users to visit the site. The code will looks like as below:

 

$maintenanceFile = 'maintenance.flag';
$ip = $_SERVER['REMOTE_ADDR'];

/***************
* IP's allowed in maintenance.
* Use publicly visible IP addresses on LIVE, local if on DEV
***************/

$allowed = array('10.0.0.100','10.0.0.101','10.0.0.20');

if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) {
   $basePath = dirname($_SERVER['PHP_SELF']);
   include_once dirname(__FILE__) . '/errors/503.php';
   exit;
}

 

You can also follow the below step to solve this issue:


Step 1. Log into the cPanel of your Magento shop


Step 2. Now in there under category Files, click on Filemanager.


Step 3. Next go to the homedir of your Magento shop.


Step 4. In here you need to Delete the maintenance.flag file


Step 5. Next go to the var/cache folder of your Magento shop


Step 6. In here Delete all the caching files


Step 7. Now if you reload the webshop, the error should be gone!