{"id":8619,"date":"2025-02-24T22:00:21","date_gmt":"2025-02-24T16:30:21","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=8619"},"modified":"2026-11-02T16:27:39","modified_gmt":"2026-11-02T10:57:39","slug":"how-to-enable-maintenance-mode-in-magento-2","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-enable-maintenance-mode-in-magento-2\/","title":{"rendered":"How to Enable Maintenance Mode in Magento and Customize the Maintenance Page"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong><strong>Post Date:<\/strong><\/strong> February 24, 2025<strong><br><strong>Last Updated:<\/strong> <\/strong>November 02, 2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Maintaining an eCommerce website is essential to ensure security, stability, and a seamless shopping experience. However, performing software upgrades, installing security patches, updating extensions, migrating databases, or making server-level changes while customers are actively using the store can lead to unexpected errors, checkout failures, and service interruptions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><a href=\"https:\/\/www.magento-opensource.com\/\" target=\"_blank\" rel=\"noopener\">Magento 2<\/a> Maintenance Mode<\/strong> provides a built-in solution to temporarily restrict public access to your online store while essential maintenance activities are performed. When maintenance mode is enabled, visitors receive an HTTP 503 (Service Unavailable) response instead of accessing the storefront.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One of the key advantages of Magento 2 maintenance mode is its IP whitelisting functionality. Administrators and developers can allow specific IP addresses to access the store during maintenance, making it possible to test updates, verify functionality, and perform necessary checks without exposing an incomplete website to customers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this step-by-step guide, we will explain how to enable and disable maintenance mode in Magento 2, allow specific IP addresses, customise the maintenance page, and troubleshoot common issues. We will also cover important checks to perform before restoring your store to normal operation.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. What Is Maintenance Mode in Magento 2?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 maintenance mode is a built-in feature that temporarily restricts access to the storefront while developers or administrators perform maintenance activities.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When maintenance mode is activated, Magento creates a <code>.maintenance.flag<\/code> file inside the <code>var\/<\/code> directory. This file indicates that the application is in maintenance mode.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Visitors who are not included in the allowed IP list receive a <strong>503 Service Unavailable<\/strong> response.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">When Should You Enable Magento Maintenance Mode?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Maintenance mode is recommended during the following activities:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Magento version upgrades and software updates.<\/li>\n\n\n\n<li>Security patch installations.<\/li>\n\n\n\n<li>Third-party extension installations or updates.<\/li>\n\n\n\n<li>Database migrations and schema modifications.<\/li>\n\n\n\n<li>Theme and storefront customisations.<\/li>\n\n\n\n<li>Server maintenance and infrastructure upgrades.<\/li>\n\n\n\n<li>Production deployments and configuration changes.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Using maintenance mode helps minimise customer-facing errors and provides a controlled environment for performing important updates.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Prerequisites Before Enabling Maintenance Mode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before enabling maintenance mode in Magento 2, make sure the following requirements are met:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>SSH access to the Magento server.<\/li>\n\n\n\n<li>Access to the Magento application root directory.<\/li>\n\n\n\n<li>Appropriate permissions to execute Magento CLI commands.<\/li>\n\n\n\n<li>A recent backup of the database and application files.<\/li>\n\n\n\n<li>The IP addresses of administrators and developers who require access during maintenance.<\/li>\n\n\n\n<li>A planned maintenance window to minimise customer disruption.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Important:<\/strong> Execute Magento CLI commands using the appropriate Magento filesystem owner account.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. How to Enable Maintenance Mode in Magento 2<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 provides a built-in CLI command to enable maintenance mode.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Navigate to the Magento Root Directory<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Connect to your Magento server through SSH and navigate to the application root directory.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd \/var\/www\/html\/magento2<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace the example path with your actual Magento installation directory.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Enable Maintenance Mode<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Execute the following command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:enable<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Enabled maintenance mode<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once enabled, Magento restricts public access to the storefront and displays a maintenance page with an HTTP 503 response.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Verify Maintenance Mode Status<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To confirm whether maintenance mode is active, execute:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:status<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Maintenance mode is active.<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This confirms that Magento maintenance mode has been successfully enabled.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. How to Allow Specific IP Addresses During Maintenance Mode<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 provides an IP whitelisting feature that allows selected users to access the storefront even when maintenance mode is enabled.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is particularly useful for developers, administrators, and QA teams who need to test website functionality during maintenance.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Allow a Single IP Address<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To allow a single IP address, execute:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:allow-ips 192.168.1.100<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>192.168.1.100<\/code> with the actual public IP address that requires access.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Allow Multiple IP Addresses<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To allow multiple IP addresses, specify them in the same command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:allow-ips 192.168.1.100 192.168.1.101<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Alternatively, you can enable maintenance mode with IP exemptions directly:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:enable --ip=192.168.1.100 --ip=192.168.1.101<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Verify Allowed IP Addresses<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:status<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check the output to confirm that the required IP addresses are exempt from maintenance mode.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Remove All Allowed IP Addresses<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If you want to block all visitors, including previously whitelisted IP addresses, execute:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:allow-ips --none<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> Make sure you use the correct public IP addresses. If your store is behind a reverse proxy, CDN, or load balancer, verify which client IP address Magento receives.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. How to Customise the Magento 2 Maintenance Page<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 provides a default maintenance page that displays a Service Unavailable message whenever maintenance mode is enabled.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, store owners can customise this page to display their company branding, maintenance notifications, estimated completion time, and customer support information.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Default Maintenance Page Location<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The default maintenance page template is located at:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">pub\/errors\/default\/503.phtml<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Create a Custom Maintenance Page<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Follow these steps to customise the maintenance page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 1: Navigate to the Magento Errors Directory<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cd \/var\/www\/html\/magento2\/pub\/errors<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 2: Create a Custom Maintenance Page<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create or edit the following file:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">nano 503.phtml<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 3: Add Custom HTML Content<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can use the following example:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;!DOCTYPE html>\n&lt;html lang=\"en\">\n&lt;head>\n    &lt;meta charset=\"UTF-8\">\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    &lt;title>Store Under Maintenance&lt;\/title>\n    &lt;style>\n        body {\n            font-family: Arial, sans-serif;\n            text-align: center;\n            padding: 100px 20px;\n            background: #f5f5f5;\n        }\n        .maintenance-box {\n            max-width: 600px;\n            margin: auto;\n            padding: 40px;\n            background: #ffffff;\n            border-radius: 10px;\n        }\n        h1 {\n            color: #333333;\n        }\n        p {\n            color: #666666;\n            line-height: 1.6;\n        }\n    &lt;\/style>\n&lt;\/head>\n&lt;body>\n    &lt;div class=\"maintenance-box\">\n        &lt;h1>We'll Be Back Soon!&lt;\/h1>\n        &lt;p>\n            Our online store is currently undergoing scheduled\n            maintenance to improve your shopping experience.\n        &lt;\/p>\n        &lt;p>Thank you for your patience.&lt;\/p>\n    &lt;\/div>\n&lt;\/body>\n&lt;\/html><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Save the file after making the necessary changes.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 4: Verify the Custom Maintenance Page<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Access your Magento storefront from an IP address that is not whitelisted and verify that the customised maintenance page is displayed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Magento-Maintenance-Page-Preview-1024x683.png\" alt=\"Magento 2 custom maintenance page displaying a &quot;We'll Be Back Soon&quot; message after enabling maintenance mode.\n\" class=\"wp-image-12750\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Magento-Maintenance-Page-Preview-1024x683.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Magento-Maintenance-Page-Preview-300x200.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Magento-Maintenance-Page-Preview-768x512.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Magento-Maintenance-Page-Preview-272x182.png 272w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Magento-Maintenance-Page-Preview.png 1536w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> The custom page should be configured using Magento&#8217;s error-page mechanism. The <code>pub\/errors\/503.phtml<\/code> file is the custom override location; retain the default template as a reference and test the result in your specific Magento version and server configuration.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For simple template changes, static content deployment is generally unnecessary. If you also modify static CSS, JavaScript, or theme assets, deploy the relevant static content as required.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">6. How to Disable Maintenance Mode in Magento 2<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After completing all maintenance activities, disable maintenance mode to restore public access to your Magento storefront.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Disable Maintenance Mode<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to the Magento root directory and execute:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:disable<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Disabled maintenance mode<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Verify Maintenance Mode Status<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:status<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Maintenance mode is not active.<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This confirms that maintenance mode has been successfully disabled.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Clear Magento Cache<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To ensure the latest application changes are reflected on the storefront, execute:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento cache:clean<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If required, you can also flush the Magento cache:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento cache:flush<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Verify Storefront Accessibility<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Open your Magento storefront in a browser and check the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Homepage loads successfully.<\/li>\n\n\n\n<li>Product and category pages are accessible.<\/li>\n\n\n\n<li>Customer login and registration work.<\/li>\n\n\n\n<li>Add-to-cart functionality works correctly.<\/li>\n\n\n\n<li>Checkout and payment functionality are operational.<\/li>\n\n\n\n<li>Admin panel access is available.<\/li>\n\n\n\n<li>No unexpected 500 or 503 errors appear.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">7. Troubleshooting Common Magento 2 Maintenance Mode Issues<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Even after executing the maintenance commands, administrators may sometimes encounter maintenance-related errors. Below are some common issues and their solutions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Issue 1: Magento Store Still Displays the Maintenance Page After Disabling Maintenance Mode<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible cause:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The maintenance flag file may still exist, or a cache or proxy layer may be serving an outdated response.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Solution:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, verify the maintenance mode status:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:status<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If maintenance mode is still active, disable it:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:disable<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the maintenance flag remains after confirming the application state, inspect and remove it manually if appropriate:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">rm -f var\/.maintenance.flag<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then clear the cache:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento cache:clean<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Recheck the storefront.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Issue 2: Getting a 503 Service Unavailable Error After Disabling Maintenance Mode<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible cause:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A 503 error may be caused by stale cache, web server configuration issues, PHP errors, or application-level problems.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Solution:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Clear the Magento cache:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento cache:flush<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check the web server and PHP service status.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For Apache:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl status apache2<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For Nginx:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl status nginx<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Review the Magento logs:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">tail -n 50 var\/log\/system.log\ntail -n 50 var\/log\/exception.log<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Also inspect the web server error logs to identify the cause of the 503 response.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Issue 3: Whitelisted IP Address Cannot Access the Store<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible cause:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The configured IP address may not match the actual client IP address received by Magento.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Solution:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check the public IP address of the system accessing the storefront and update the allowed IP list:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:allow-ips 192.168.1.100<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If your application uses a CDN, reverse proxy, or load balancer, verify the forwarded client IP configuration.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Issue 4: Storefront Is Accessible Even After Enabling Maintenance Mode<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible cause:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The storefront may be serving cached pages through a CDN, reverse proxy, or full-page cache.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Solution:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Clean the Magento cache:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento cache:clean<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check the CDN or reverse proxy cache configuration and verify that maintenance responses are not being bypassed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For multi-node deployments, verify that maintenance mode is enabled consistently across all application nodes.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Issue 5: Maintenance Mode Remains Active on a Multi-Server Environment<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Possible cause:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The maintenance flag may not be synchronised across multiple application servers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Solution:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Verify the maintenance flag and maintenance status on every application node. Ensure that all nodes use the correct shared or synchronised application filesystem and that traffic is not being routed to an unmodified node.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">8. Magento 2 Maintenance Mode Best Practices<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To ensure a smooth maintenance process and minimise downtime, follow these recommended practices:<\/p>\n\n\n\n<ol start=\"1\" class=\"wp-block-list\">\n<li><strong>Take a backup:<\/strong> Back up the Magento application files and database before performing major changes.<\/li>\n\n\n\n<li><strong>Schedule maintenance:<\/strong> Perform updates during low-traffic hours to reduce the impact on customers.<\/li>\n\n\n\n<li><strong>Whitelist administrator IPs:<\/strong> Allow authorised developers and administrators to test the application.<\/li>\n\n\n\n<li><strong>Stop background consumers when required:<\/strong> Follow the deployment procedure for queue consumers and scheduled jobs.<\/li>\n\n\n\n<li><strong>Use a custom maintenance page:<\/strong> Display a clear message and relevant customer support details.<\/li>\n\n\n\n<li><strong>Test before going live:<\/strong> Verify product pages, customer accounts, cart, checkout, and payment functionality.<\/li>\n\n\n\n<li><strong>Monitor application logs:<\/strong> Review Magento, PHP, and web server logs for errors.<\/li>\n\n\n\n<li><strong>Disable maintenance mode promptly:<\/strong> Restore customer access immediately after completing the maintenance work.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 maintenance mode is an essential feature for maintaining the security, stability, and performance of an eCommerce website. Whether you are upgrading Magento, installing security patches, updating extensions, migrating databases, or performing server maintenance, enabling maintenance mode helps prevent customers from experiencing incomplete updates, broken pages, and unexpected application errors.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By using Magento CLI commands, administrators can easily enable or disable maintenance mode, whitelist authorised IP addresses, and customise the maintenance page to provide a better customer experience during planned downtime.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Following the recommended maintenance practices, including taking backups, checking application logs, testing critical storefront functionality, and verifying the maintenance status before restoring public access, helps ensure a smooth and reliable maintenance process.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Need professional assistance with Magento 2 maintenance, upgrades, or server administration?<\/strong> The technical team at Pheonix Solutions can help you maintain a secure, stable, and high-performing eCommerce environment. Contact our experts to discuss your requirements.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions (FAQ)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. How do I enable maintenance mode in Magento 2?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Navigate to your Magento root directory and execute:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:enable<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This enables maintenance mode and displays a 503 Service Unavailable page to visitors who are not whitelisted.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. How do I disable maintenance mode in Magento 2?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Execute the following command from your Magento root directory:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:disable<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This restores normal storefront access.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. How can I allow my IP address during Magento 2 maintenance mode?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Use the following command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:allow-ips YOUR_IP_ADDRESS<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>YOUR_IP_ADDRESS<\/code> with your actual public IP address.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/the-magento-based-website-is-not-working-with-https\/\">The Magento Based Website Is Not Working With HTTPS<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-resolve-the-autoload-error-while-installing-magento2-in-ubuntu-18-04-20-04\/\">How to Resolve the Autoload Error While Installing Magento 2 in Ubuntu 18.04 &amp; 20.04<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-update-secure-and-unsecure-urls-directly-in-the-magento-database\/\">How to Update Secure and Unsecure URLs Directly in the Magento Database<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to Our Experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Looking for reliable Magento development, eCommerce maintenance, or infrastructure support?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><a href=\"https:\/\/pheonixsolutions.com\/web-development\/\">Pheonix Solutions<\/a><\/strong> provides technology services covering Magento development, server administration, cloud infrastructure, DevOps, website maintenance, and technical support.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Our experts can help you maintain, troubleshoot, and optimise your eCommerce platform.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/contact\">Contact our experts<\/a> to discuss your requirements.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post Date: February 24, 2025Last Updated: November 02, 2026 Introduction Maintaining an eCommerce website is essential to ensure security, stability, [&hellip;]<\/p>\n","protected":false},"author":514,"featured_media":12757,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[],"class_list":["post-8619","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-architecture","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-2f1","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Magento-2-Maintenance-Mode-Guide.png","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/514"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=8619"}],"version-history":[{"count":2,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8619\/revisions"}],"predecessor-version":[{"id":12768,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8619\/revisions\/12768"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media\/12757"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=8619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=8619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=8619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}