自动Apache服务器维护页 [英] Automated Apache Server Maintenance Page

查看:326
本文介绍了自动Apache服务器维护页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有需要自动进行服务器的维护,这将持续的时间的任意量每隔几个月脱机一个Linux /阿帕奇/ Tomcat的栈上运行的网站。什么是让阿帕奇忍受,并采取了服务器维护页面的一些选项?

I have a website running on a Linux/Apache/Tomcat stack that needs to be automatically taken offline every few months for server maintenance, which will last an arbitrary amount of time. What are some options for getting Apache to put up and take down a "server maintenance" page?

我需要能够通过shell脚本来控制。 (,谷歌提供的答案围绕手动编辑服务器配置,我不想在办公室里在凌晨3点!)我想我可以使.htaccess文件脚本降和删除它时,它的完成,但似乎小于优美。

I need to be able to control this via shell script. (The answers that Google provided revolve around manually editing the server configuration, and I don't want to be in the office at 3 am!) I suppose I could make the script drop in an .htaccess file and delete it when it's done, but that seems less than graceful.

答评论:

迈克的回答看起来像最佳实践回答,但我会做什么可能是更喜欢的丹的答案因为托管服务提供商的第三方控制负载平衡器,我不想处理这个烂摊子。谢谢!

Mike's answer looks like the best-practices answer, although what I'll do is probably more like Dan's answer because the third-party hosting provider controls the load balancer and I don't want to deal with that mess. Thanks!

推荐答案

我们有一个设置是做到了这一点,但它不仅仅包括Apache的更多。有一个负载均衡器和它后面的两个服务器。这两个Web服务器服务的网站使用Apache,其中之一设有供应简单的HTML页面维护一个额外的虚拟主机。负载平衡器具有请求重定向到真实服务器虚拟HTTP服务。这个虚拟服务有三个真正的服务器:两个是实际的服务器和第三个是指向维护页面第二个服务器上的虚拟IP。真实服务器的权重与第三方具有最小可能的重量和负载平衡器使用固定加权算法。所以,当真正的网站以任何理由下线的所有请求去维修主机和用户看到的漂亮的错误页面,用一个电话号码。事实上,我用一个小脚本尽快检查真实服务器的健康状况,因此维护页面显示为有任何的风吹草动。

We have a setup that does just that but it includes more than just apache. There is a loadbalancer and two servers behind it. Both web servers serve website using Apache and one of them has an additional virtual host that serves simple HTML maintenance page. The load balancer has a virtual HTTP service that redirects requests to real servers. This virtual service has three real servers: two are actual servers and third is a virtual IP on second server that points to maintenance page. The real servers are weighted with third having the least possible weight and the load balancer uses fixed weighting algorithm. So when real websites go offline for any reason all requests go to maintenance host and users see the nice error page with a phone number. In fact I use a small script to check the health of real servers, so the maintenance page displays as soon as there is any sign of trouble.

PS。我用法师负荷1500负载均衡。

PS. I use Load Master 1500 for loadbalancer.

这篇关于自动Apache服务器维护页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆