我将mod-proxy和mod- proxy -balancer设置为负载平衡反向代理。如下所示:
<Proxy balancer://example>
BalancerMember http://hostname:8000 keepalive=on
BalancerMember http://hostname:8001 keepalive=on
</Proxy>
ProxyPass / balancer://example/
ProxyPassReverse / balancer://example/
ProxyPreserveHost on
ProxyRequests Off有没有一种简单的方法可以将其设置为在平衡器组的所有成员都关闭时显示静态维护页面?我之前已经用硬件负载均衡器做到了这一点,它非常有用。
发布于 2009-06-03 02:16:35
也许你可以使用热备份。下面的示例来自ProxyPass Directive部分,其中显示“设置热备份,只有在没有其他成员可用的情况下才会使用”
ProxyPass / balancer://hotcluster/
<Proxy balancer://hotcluster>
BalancerMember http://1.2.3.4:8009 loadfactor=1
BalancerMember http://1.2.3.5:8009 loadfactor=2
# The below is the hot standby
BalancerMember http://1.2.3.6:8009 status=+H
ProxySet lbmethod=bytraffic </Proxy>发布于 2009-11-13 05:44:32
作为RewriteRule的替代方案,您可以使用适当的ErrorDocument指令来做同样的事情。我们这样做:代理服务器本身托管静态错误页面,而“热备用”主机是http://localhost/some-app/。
发布于 2013-08-29 16:31:35
由于您的代理似乎是唯一的页面(可能在VirtualHost中),您可以简单地覆盖错误页面。Apache会生成一个503错误,因此如下所示:
# Document root is required because error documents use relative paths
DocumentRoot /var/www/html/
# Allow access to document root directory
<Directory /var/www/html/>
Order allow,deny
allow from all
</Directory>
# Actual change: If service is unavailable (no member available), show this page
ErrorDocument 503 /maintenance.html如果你想在维护html中使用图片,请不要使用绝对路径(例如/image.jpg)来加载/var/www/html/image.jpg。
https://stackoverflow.com/questions/942735
复制相似问题