问题原文
原帖链接 · Justin Grimes · CC BY-SA 3.0
I have several http and game servers on a network and currently use an Apache2 reverse proxy to divvy out traffic between domains and machines.
I am getting a significant amount more traffic to one machine in particular than others. I would like to know where to start with using my virtual hosts to direct excess traffic to a different machine.
Essentially when 192.168.1.5 is inaccessible or heavily loaded I'd like to send this traffic to 192.168.1.6 instead.
I've tried searching but obviously I'm not even using the right terminology. Sorry for being so new at this. I'm still learning, and I appreciate any tips or pointers.
Thanks guys!
已采纳解答
原帖链接 · Justin Grimes · CC BY-SA 3.0
Ok, so I think I've found my own answer.
By using the latest version of Apache and the "FallbackResource" directive we can set an alternate destination for our clients in the event that the primary destination is unavailable. More information can be found via Apache.org below... https://httpd.apache.org/docs/2.4/mod/mod_dir.html#fallbackresource
Basically just add a line inside of the VirtualHost brackets with a single, resolvable location as the only argument. Like so...
<VirtualHost *:80>
ServerName foo.example.com
DocumentRoot /var/www/html
DirectoryIndex index.php
FallbackResource http://192.168.1.5/overflow.html
</VirtualHost>
In my specific case I'm also using ProxyPass and Reverse Proxy Pass with a separate server for each VirtualHost, so I simplified it down a bit for the example. I believe it should still be a valid example.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
