I've got a website running on the Linux/Apache/Tomcat stack that should be instantly taken offline every couple of several weeks for server maintenance, that will last a random period of time. What exactly are some choices for getting Apache to place up and take lower a "server maintenance" page?
I have to have the ability to control this via spend script. (The solutions that Google provided center around by hand editing the server configuration, and I'd rather not be at work at 3 am!) I guess I possibly could result in the script stop by an .htaccess file and remove it when it is done, but that appears under elegant.
xsaero00's answer looks prefer-practices answer, although what I'll do is most likely a lot more like Dan's answer since the third-party host company controls the burden balancer and I'd rather not cope with that mess. Thanks!
There exists a setup that does exactly that however it includes not only apache. There's a loadbalancer and 2 servers behind it. Both web servers serve website using Apache and one of these comes with an additional virtual host that serves simple HTML maintenance page. The burden balancer includes a virtual HTTP service that redirects demands to real servers. This virtual service has three real servers: two are actual servers and third is really a virtual IP on second server that indicates maintenance page. The actual servers are weighted with third getting minimal possible weight and also the load balancer uses fixed weighting formula. Then when real websites go offline unconditionally all demands visit maintenance host and customers begin to see the nice error page having a telephone number. Actually I personally use a little script to determine the health of real servers, therefore the maintenance page shows the moment there's any hint of problems.
PS. I personally use Load Master 1500 for loadbalancer.
it's pretty simple to launch Apache having a custom config file. On my small system:
httpd -f <config>
I personally use this regularly in conjunction with a spend script an an very simple config like a maintenance placeholder. The script simply stops my regular Apache, and begins this.
make 2 config files and swap them backwards and forwards
If perhaps some the file can change, merge all of them with come kind of preprocessor and generate both standard and also the "off-line" versions in one source and swap between individuals.
IIRC the apache config files are build using CPP anyway
We've done such like. There's an index.html that redirects to the primary site page. Whenever we have maintenance we operate a script that changes the redirect within the html file. Only then do we with the script in cron and viola automatic maintenance window.
Hope that can help!