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)
- Create /opt/placeholder/index.html with your placeholder message.
- Copy your /etc/httpd/conf/httpd.conf to placeholder-httpd.conf
- Edit placeholder-httpd.conf
- Remove all lines starting with “Include”
- Remove all <vitualhost> blocks
- Add the following to the bottom of placeholder-httpd.conf
<VirtualHost *:80> DocumentRoot /opt/placeholder </VirtualHost>
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.
Nice. Others have also used Rewrite to be more flexible too.
http://www.deadmarshes.com/Blog/web/Custom%20Downtime%20Message.html
Yup, that’s useful too when in less of a utter hurry. Nice to have the link on this post.
Well,my apache wont start after the changes.Any suggestions on why ?