自动化的Apache服务器维护页面(Automated Apache Server Maintenance Page)

编程入门 行业动态 更新时间:2024-10-19 12:43:54
自动化的Apache服务器维护页面(Automated Apache Server Maintenance Page)

我有一个运行在Linux / Apache / Tomcat堆栈上的网站,每隔几个月需要自动脱机进行服务器维护,这将持续任意时间。 有什么方法可以让Apache放置并取下“服务器维护”页面?

我需要能够通过shell脚本来控制它。 (Google提供的答案是围绕手动编辑服务器配置,而我不想在凌晨3点在办公室!)我想我可以将脚本放在.htaccess文件中,并在完成时将其删除,但这似乎不够优雅。


解答评论:

Mike的答案看起来像是最佳实践的答案,但我要做的可能更像Dan的答案,因为第三方托管提供商控制负载均衡器,我不想处理这种混乱。 谢谢!

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?

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.


Answer commentary:

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。 真正的服务器用第三权重加权,负载均衡器使用固定权重算法。 因此,当真正的网站由于任何原因离线时,所有请求都将转到维护主机,用户通过电话号码查看错误页面。 事实上,我使用一个小脚本来检查真实服务器的运行状况,因此一旦出现任何问题迹象,就会显示维护页面。

PS。 我使用Load Master 1500作为负载均衡器。

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. I use Load Master 1500 for loadbalancer.

更多推荐

本文发布于:2023-07-22 09:55:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1219147.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:页面   服务器   Apache   Automated   Page

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!