Skip to content

Temporary downtime httpd.conf

If you have to offline an entire webserver for an upgrade to a complicated site, or some other reason, here’s a quick (and not too dirty) way to put up a placeholder page on ALL the virtualhosts on the server.

Nb. These instructions are for RedHat Linux Enterprise, but the concept is easy enough to do on any UNIX.

To prepare the placeholder: (adjust paths to suit taste)

  1. Create /opt/placeholder/index.html with your placeholder message.
  2. Copy your /etc/httpd/conf/httpd.conf to placeholder-httpd.conf
  3. Edit placeholder-httpd.conf
    1. Remove all lines starting with “Include”
    2. Remove all <vitualhost> blocks
    3. Add the following to the bottom of placeholder-httpd.conf
      <VirtualHost *:80>
        DocumentRoot /opt/placeholder

When you want to make this go live, shut down the normal server:

service httpd stop

And then bring up apache with our custom config:

/usr/sbin/httpd -f /etc/httpd/conf/placeholder-httpd.conf

And that should serve your place holder page to any HTTP request to the server!

When you’re done, kill the root httpd process and restart normal httpd service.

Posted in Apache.

Tagged with .

3 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Daniel Alexander Smi says

    Nice. Others have also used Rewrite to be more flexible too.

  2. Hasan Kurtoglu says

    Well,my apache wont start after the changes.Any suggestions on why ?

Some HTML is OK

or, reply to this post via trackback.