Taking a sever down for maintenance.

This is a discussion on Taking a sever down for maintenance. within the Apache Web Server forums, part of the Web Server and Related Forums category; What is the best way to take an Apache UNIX server with number virtual hosts down for maintenance purposes? By ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-07-2004
David Kirkby
 
Posts: n/a
Default Taking a sever down for maintenance.

What is the best way to take an Apache UNIX server with number virtual
hosts down for maintenance purposes? By that I mean take it to
single-user mode, but with users getting an explanatory message, rather
than what appears to be a dead site.

Clearly I need to do that on another server, since if the first is down,
there is no way it can reply to requests.

I was thinking of something like putting up a simple server, with one
virtual host, which matched nothing, so apache would default to that.


<VirtualHost *:80>
DocumentRoot /usr/local/apache2/htdocs/some-non-existent-domain
ServerName www.some-non-existent-domain.com
ErrorDocument 404 /warnings/down-for-maintenance.html
</VirtualHost>


That would probably work, as any request would generate a 404 (file not
found), but I'm sure others have hit this problem before, and know of
better ways.




  #2 (permalink)  
Old 11-07-2004
Davide Bianchi
 
Posts: n/a
Default Re: Taking a sever down for maintenance.

["Followup-To:" header set to alt.apache.configuration.]
On 2004-11-07, David Kirkby <nospam@nowhere.com> wrote:
> I was thinking of something like putting up a simple server, with one
> virtual host, which matched nothing, so apache would default to that.


Then do not define any VHost at all. What's the point of having one
vhost that doesn't match anything?

Do the maintenance in the whee hours of the night when the load is
low, be quick and don't fuckup (the last one is the tricky part).

Davide

--
Double your drive space: Delete Windows!
  #3 (permalink)  
Old 11-07-2004
David Kirkby
 
Posts: n/a
Default Re: Taking a sever down for maintenance.

Davide Bianchi wrote:
> ["Followup-To:" header set to alt.apache.configuration.]
> On 2004-11-07, David Kirkby <nospam@nowhere.com> wrote:
>
>>I was thinking of something like putting up a simple server, with one
>>virtual host, which matched nothing, so apache would default to that.

>
>
> Then do not define any VHost at all. What's the point of having one
> vhost that doesn't match anything?


I was thinking that since apache will always go to the first if it does
not match, but then thinking about it more, I might just as well have the

ErrorDocument 404 /warnings/down-for-maintenance.html

where /warnings if off of the document root. I'll try that.

> Do the maintenance in the whee hours of the night when the load is
> low, be quick and don't fuckup (the last one is the tricky part).


One of my sites is only of interested to those in the UK (in fact my
part of Essex), so clearly it only gets hit during the day. But another
has more activity, evenly spread throughout the day.



> Davide
>


  #4 (permalink)  
Old 11-07-2004
c00lk1d
 
Posts: n/a
Default Re: Taking a sever down for maintenance.

well if you have a machine where you want to setup to display the
msg...
why not jsut copy the whole config and data to that machine. so every
thing stays running. while you work on the other one. once your done,
put back the good server

  #5 (permalink)  
Old 11-07-2004
Davide Bianchi
 
Posts: n/a
Default Re: Taking a sever down for maintenance.

On 2004-11-07, c00lk1d <jorge.schrauwen@gmail.com> wrote:
> why not jsut copy the whole config and data to that machine.


Because usually, the hassle to setup such a machine, that can run _all_
the sites with all the bell & whistles, the databases, the configuration
and so on, severely overweight the work you have to perform on the
original machine, so there is no reason at that point to swap the old
machine back in place. And you ends up having two identical or almost
identical machines. But not everybody can spare a _production_ready_
machine just for normal maintenance, so the idea to have a simple
normal PC just to show up a "sorry, we are closed" page does make
sense to me.

Davide

--
A truly stable environment would be a concrete basement with no windows!
Computers are no different. -- Carey McLelland
  #6 (permalink)  
Old 11-07-2004
stuart miller
 
Posts: n/a
Default Re: Taking a sever down for maintenance.

Davide Bianchi wrote:

> On 2004-11-07, c00lk1d <jorge.schrauwen@gmail.com> wrote:
>> why not jsut copy the whole config and data to that machine.

>
> Because usually, the hassle to setup such a machine, that can run _all_
> the sites with all the bell & whistles, the databases, the configuration
> and so on, severely overweight the work you have to perform on the
> original machine, so there is no reason at that point to swap the old
> machine back in place. And you ends up having two identical or almost
> identical machines. But not everybody can spare a _production_ready_
> machine just for normal maintenance, so the idea to have a simple
> normal PC just to show up a "sorry, we are closed" page does make
> sense to me.
>
> Davide


I like the 'sorry we are closed" approach, but I can see some issues.

It should not be hard to use the vhosts to have a 'closed' page for each
host.

A basic machine to run the web server only (p100, 1 gig drive) is almost
free these days, and you only have to set it up once.

If you have a dynamic ip address from your isp, you may have a problem. In
my case, the dynamic ip address I get is a function of the MAC address on
the network card, so swapping in a 'sorry we are closed' machine may be
difficult. Some routers let you clone a MAC address, but if you are
outside, you may need to move the network card from the 'real' machine to
the 'closed' machine, then move it back.
Here, one server is behind the firewall, so to 'replace' it would simply be
a matter of redirecting the router, instead of to xxx.xxx.xxx.xxx.81 I send
it to xxx.82


Stuart

  #7 (permalink)  
Old 11-07-2004
Matt Bradley
 
Posts: n/a
Default Re: Taking a sever down for maintenance.

David Kirkby wrote:
> What is the best way to take an Apache UNIX server with number virtual
> hosts down for maintenance purposes? By that I mean take it to
> single-user mode, but with users getting an explanatory message, rather
> than what appears to be a dead site.
>
> Clearly I need to do that on another server, since if the first is down,


Unless you swap the equipment out, and put in another box on the same IP?


> <VirtualHost *:80>
> DocumentRoot /usr/local/apache2/htdocs/some-non-existent-domain
> ServerName www.some-non-existent-domain.com
> ErrorDocument 404 /warnings/down-for-maintenance.html
> </VirtualHost>
>
>
> That would probably work, as any request would generate a 404 (file not
> found), but I'm sure others have hit this problem before, and know of
> better ways.



If it's going to be out for a while, you might want a 302 to be sent
instead of a 404? Otherwise, a passing search engine spider might think
the site has gone forever?


--
Matt Bradley
"I always like to know everything about my new friends,
and nothing about my old ones" - Oscar Wilde (The Picture of Dorian Gray)
  #8 (permalink)  
Old 11-07-2004
HansH
 
Posts: n/a
Default Re: Taking a sever down for maintenance.

"stuart miller" <stuart_miller@shaw.ca> schreef in bericht
news:krujd.143096$%k.65933@pd7tw2no...
> Davide Bianchi wrote:
> > ... , so the idea to have a simple normal PC just to show up
> > a "sorry, we are closed" page does make sense to me.

> I like the 'sorry we are closed" approach, but I can see some issues.
> It should not be hard to use the vhosts to have a 'closed' page for each
> host.

'Think it's easier to script -or even URLrewrite- it based on the host
header.

HansH


  #9 (permalink)  
Old 11-09-2004
David Kirkby
 
Posts: n/a
Default Re: Taking a sever down for maintenance.

Matt Bradley wrote:
> David Kirkby wrote:
>
>> What is the best way to take an Apache UNIX server with number virtual
>> hosts down for maintenance purposes? By that I mean take it to
>> single-user mode, but with users getting an explanatory message, rather
>> than what appears to be a dead site.
>>
>> Clearly I need to do that on another server, since if the first is down,

>
>
> Unless you swap the equipment out, and put in another box on the same IP?


Well, I take that to mean another server.

> If it's going to be out for a while, you might want a 302 to be sent
> instead of a 404? Otherwise, a passing search engine spider might think
> the site has gone forever?


How do you do that? And what will spiders think of it - will they just
come back later?

  #10 (permalink)  
Old 11-09-2004
Matt Bradley
 
Posts: n/a
Default Re: Taking a sever down for maintenance.

David Kirkby wrote:
> Matt Bradley wrote:
>
>> David Kirkby wrote:
>>
>>> What is the best way to take an Apache UNIX server with number virtual
>>> hosts down for maintenance purposes? By that I mean take it to
>>> single-user mode, but with users getting an explanatory message, rather
>>> than what appears to be a dead site.
>>>
>>> Clearly I need to do that on another server, since if the first is down,

>>
>>
>>
>> Unless you swap the equipment out, and put in another box on the same IP?

>
>
> Well, I take that to mean another server.
>
>> If it's going to be out for a while, you might want a 302 to be sent
>> instead of a 404? Otherwise, a passing search engine spider might
>> think the site has gone forever?

>
>
> How do you do that? And what will spiders think of it - will they just
> come back later?


I've had a change of heart about sending 302. I'm not sure search
engines would read that correctly. The following should send an http 200
for every page, meaning that the spiders will at least know that the
site still exists.

Firstly, you'd be wanting to make sure your solitary <VirtualHost>
directive had a DirectoryIndex directive:

DirectoryIndex /down-for-maintenance.html

Then you might want to rewrite all other URI's to that document as well,
without sending a 404 out (I think this is the correct regex):

RewriteEngine on
RewriteRule (.*) /down-for-maintenance.html

So you end up with:

<VirtualHost *:80>
DocumentRoot /usr/local/apache2/htdocs/some-non-existent-domain
ServerName www.some-non-existent-domain.com
DirectoryIndex /down-for-maintenance.html
RewriteEngine on
RewriteRule (.*) /down-for-maintenance.html
</VirtualHost>

I don't know whether this is best practice or not. I'm sure somebody
else will have more input. To be honest, if you've got two pieces of
hardware at your disposal, there's no good reason to take the sites down
at all.



--
Matt Bradley
"Myths which are believed in tend to become true"
-George Orwell
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:55 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0