How to Enable Maintenace Page (using redirect) on the Openstack DashboardΒΆ
Inside the OpenStack dashboard create the maintenance directory:
$ mkdir /var/www/maintenance/
Enter the maintenance directory and create an index.html that will be used as maintenance page:
------------ | EXAMPLE | ------------ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> <title>GARR cloud Maintenance</title> <style type="text/css"> body { text-align: center; padding: 150px; } h1 { font-size: 50px; } body { font: 20px Helvetica, sans-serif; color: #333; } #article { display: block; text-align: left; width: 650px; margin: 0 auto; } a { color: #dc8100; text-decoration: none; } a:hover { color: #333; text-decoration: none; } </style> </head> <body> <div id="article"> <h1>We’ll be back soon!</h1> <div> <img width="100" src="GarrCloud.png" alt="GARR Cloud Logo" class="floating_element"/> <p>Sorry for the inconvenience but we’re performing some maintenance at the moment. The running instances are unaffected. If you need to you can always contact us on <b>cloud-support AT garr.it</b>, otherwise we’ll be back online shortly! </p> <p>— GARR cloud support</p> </div> </div> </body> </html>
Edit the file in /etc/apache2/sites-enabled/default-ssl.conf and after the line DocumentRoot /var/www insert the following code:
RewriteEngine on #enable switch RewriteCond %{DOCUMENT_ROOT}/enable-maintenance -f #remove loop RewriteCond %{REQUEST_URI} !^/maintenance* #redirect RewriteRule ^(.*)$ https://dashboard.cloud.garr.it/maintenance/index.html [R=302,L]
Create the configuration file /etc/apache2/conf-available/maintenance.conf as shown below:
Alias /maintenance /var/www/maintenance <Directory /var/www/maintenance> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory>
Enable maintenance configuration:
$ a2enconf maintenance
Create an empty file named maintenance:
touch /var/www/enable-maintenance
Restart the Apache service:
$ sudo service apache2 restart