Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Users

simple easy way to turn to maintenance mode

 

 

Apache users RSS feed   Index | Next | Previous | View Threaded


miguel_3_gonzalez at yahoo

May 27, 2012, 4:42 AM

Post #1 of 7 (1548 views)
Permalink
simple easy way to turn to maintenance mode

Dear all,

   I'm administering Apache and Tomcat web servers. From time to time we have to turn the web server down and would be nice to have a maintenance mode message to the users.

   The version of Plesk we have doesn't support this so maybe there is any easy way to do this. I've thought about setting up a different instance of the web server or configure a different web server but maybe I'm missing an even simplier way to do this. In fact we only want to send a simple html response to the user.

   Regards,

   Miguel 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


mark at catseye

May 28, 2012, 9:43 AM

Post #2 of 7 (1519 views)
Permalink
Re: simple easy way to turn to maintenance mode [In reply to]

On May 27, 2012 7:42 , Miguel Gonzalez <miguel_3_gonzalez [at] yahoo> wrote:
> I'm administering Apache and Tomcat web servers. From time to time we have to turn the web server down and would be nice to have a maintenance mode message to the users.

Why do you have to do maintenance?

If you need to update the web server kernel, libraries, and so on, then
you should have another physical web server at which you can point your
load balancer (or DNS). This can be a very small, simple server that
just serves a single static page. Alternatively, your load balancer may
be able to do this itself already without the need for another physical
server.

If what you are doing maintenance on is actually a web application and
it's database, then you may be able to keep Apache HTTP Server running
to provide the maintenance mode message. The easiest way to do this is
with login in the web application itself. However, you could also have
a second set of Apache HTTP Server configuration files that cause httpd
to do nothing but serve the static maintenance message for all URLs
under your web virtual hosts -- when you begin maintenance, stop httpd
and start it up again using the new configuration files, and when you
end maintenance stop httpd and start it using your regular configuration
files.

--
Mark Montague
mark [at] catseye


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


yehuda at ymkatz

May 28, 2012, 7:14 PM

Post #3 of 7 (1510 views)
Permalink
Re: simple easy way to turn to maintenance mode [In reply to]

On Mon, May 28, 2012 at 12:43 PM, Mark Montague <mark [at] catseye> wrote:

> On May 27, 2012 7:42 , Miguel Gonzalez <miguel_3_gonzalez [at] yahoo> wrote:
>
>> I'm administering Apache and Tomcat web servers. From time to time we
>> have to turn the web server down and would be nice to have a maintenance
>> mode message to the users.
>>
>
> If what you are doing maintenance on is actually a web application and
> it's database, then you may be able to keep Apache HTTP Server running to
> provide the maintenance mode message. The easiest way to do this is with
> login in the web application itself. However, you could also have a second
> set of Apache HTTP Server configuration files that cause httpd to do
> nothing but serve the static maintenance message for all URLs under your
> web virtual hosts -- when you begin maintenance, stop httpd and start it up
> again using the new configuration files, and when you end maintenance stop
> httpd and start it using your regular configuration files.
>

We use mod_rewrite:
RewriteEngine On
# TO ALLOW YOURSELF TO VISIT THE SITE, CHANGE 111 222 333 444 TO YOUR IP
ADDRESS.
# RewriteCond %{REMOTE_ADDR} !^111\.222\.333\.444$
RewriteRule .* - [R=503,L]

Courtesy of http://25yearsofprogramming.com/blog/20070704.htm


DRuggeri at primary

May 31, 2012, 10:59 AM

Post #4 of 7 (1509 views)
Permalink
Re: simple easy way to turn to maintenance mode [In reply to]

On 5/27/2012 6:42 AM, Miguel Gonzalez wrote:
> The version of Plesk we have doesn't support this so maybe there is any easy way to do this. I've thought about setting up a different instance of the web server or configure a different web server but maybe I'm missing an even simplier way to do this. In fact we only want to send a simple html response to the user.

I'm a fan of using:
<VirtualHost *:80>
<IfDefine MAINTENANCE>
RewriteRule .* /path/to/maintenance.html [L]
</IfDefine>

#Existing directives
</VirtualHost>


... then, you only need to restart the server with -DMAINTENANCE to
enable and restart without the define to disable maintenance mode.

--
Daniel Ruggeri


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


ishimegh at gmail

Jun 1, 2012, 9:02 AM

Post #5 of 7 (1493 views)
Permalink
Re: simple easy way to turn to maintenance mode [In reply to]

Hi,

I just want to add one more question -

Daniel's idea looks very good. but what if we also want to verify the
change by logging into the site (after application level change get
complete) and then open it up for all users.. is there any way to
achieve this?

On Thu, May 31, 2012 at 1:59 PM, Daniel Ruggeri <DRuggeri [at] primary> wrote:
> On 5/27/2012 6:42 AM, Miguel Gonzalez wrote:
>>    The version of Plesk we have doesn't support this so maybe there is any easy way to do this. I've thought about setting up a different instance of the web server or configure a different web server but maybe I'm missing an even simplier way to do this. In fact we only want to send a simple html response to the user.
>
> I'm a fan of using:
> <VirtualHost *:80>
>   <IfDefine MAINTENANCE>
>      RewriteRule .* /path/to/maintenance.html [L]
>   </IfDefine>
>
>   #Existing directives
> </VirtualHost>
>
>
> ... then, you only need to restart the server with -DMAINTENANCE to
> enable and restart without the define to disable maintenance mode.
>
> --
> Daniel Ruggeri
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe [at] httpd
> For additional commands, e-mail: users-help [at] httpd
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


DRuggeri at primary

Jun 2, 2012, 6:27 AM

Post #6 of 7 (1484 views)
Permalink
Re: simple easy way to turn to maintenance mode [In reply to]

On 6/1/2012 11:02 AM, Ishita Kapadiya wrote:
> Daniel's idea looks very good. but what if we also want to verify the
> change by logging into the site (after application level change get
> complete) and then open it up for all users.. is there any way to
> achieve this?

Yes, you can control this with a condition (like looking for a specific
cookie, header or source IP address). In the example below, you would
use a cookie to gain access:

<VirtualHost *:80>
<IfDefine MAINTENANCE>
RewriteCond !%{HTTP_COOKIE} LetMeIn
RewriteRule .* /path/to/maintenance.html [L]
</IfDefine>

#Existing directives
</VirtualHost>


--
Daniel Ruggeri


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


apache at thefreecat

Jun 2, 2012, 8:47 AM

Post #7 of 7 (1483 views)
Permalink
Re: simple easy way to turn to maintenance mode [In reply to]

Le 02/06/2012 15:27, Daniel Ruggeri a écrit :
> <VirtualHost *:80>
> <IfDefine MAINTENANCE>
> RewriteCond !%{HTTP_COOKIE} LetMeIn
> RewriteRule .* /path/to/maintenance.html [L]
> </IfDefine>
> </VirtualHost>

Elegant !

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd

Apache users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.