描述:我们有两个apache服务器,一个是haproxy。 我们的新服务器位于haproxy盒后面,OLD位于不同的网络上。 我将创建一个Apache重写规则,将这个oldsite.com/some/thing指向新的haproxy框(如下所示)。 这将重定向到newsite / some / other。
问题:是否有可能使用户透明? 我希望用户只能看到oldsite.com/some/thing而不是newsite / some / other / thing? 用haproxy可以实现吗? 我对haproxy了解得很少,但不是很多。 在此先感谢您的时间。 非常感激。
DESCRIPTION: We have two apache servers and one is behind haproxy. Our NEW server is behind the haproxy box, the OLD one is on a different network. I am going to create an apache rewrite rule to point this oldsite.com/some/thing to the new haproxy box (as seen below). This will redirect to newsite/some/other thing.
QUESTION: Is it possible to make this transparent to the user? I would like the user to only see oldsite.com/some/thing and not newsite/some/other/thing ? Is this achieveable with haproxy? I know a little about haproxy but not a lot. Thanks in advance for your time. much appreciated.
最满意答案
根据@Panama Jack的提示,我创建了一个基本测试,我认为这对我来说很有用。 这只是粗略的配置,需要保护等才能充分发挥作用。 这是apache 2.4(亚马逊AMI)。 正如你在上面看到的,我想让第二个服务器对用户透明。
这个例子(快速和肮脏)安装程序执行以下操作:
login.HOST.info = login.DESTINATION.info (用户从不会看到页面实际存在的login.DESTINATION.info网址)服务器处理请求:
<VirtualHost *:80> ServerAdmin admin@localhost ServerName login.HOST.info ServerAlias www.login.HOST.info ErrorLog logs/login-error_log CustomLog logs/login-access_log common RewriteEngine On RequestHeader add X-SSL off RewriteRule ^/(.*) http://login.DESTINATION.info/$1 [P,L] </VirtualHost>最终服务器处理请求:
<VirtualHost *:80> ServerName login.DESTINATION.info ServerAdmin webmaster@site.com DocumentRoot /var/www/deal/site/locator/whatever/ RemoteIPHeader X-Forwarder-For # allows the host to remain RemoteIPInternalProxy XXXX.0.0.0/8 # ip of other machine </VirtualHost>Based on the tip from @Panama Jack, I created a basic test which I think will work for me. This is just the rough config and requires protections and so forth to get working fully. This is apache 2.4 (amazon AMI). As you see above, I am wanting to make the second server transparent to the user.
This example (quick and dirty) setup does the following:
login.HOST.info = login.DESTINATION.info (user never sees the login.DESTINATION.info url that does the page actually exists on)Server Handling Request:
<VirtualHost *:80> ServerAdmin admin@localhost ServerName login.HOST.info ServerAlias www.login.HOST.info ErrorLog logs/login-error_log CustomLog logs/login-access_log common RewriteEngine On RequestHeader add X-SSL off RewriteRule ^/(.*) http://login.DESTINATION.info/$1 [P,L] </VirtualHost>Final Server Handling the Request:
<VirtualHost *:80> ServerName login.DESTINATION.info ServerAdmin webmaster@site.com DocumentRoot /var/www/deal/site/locator/whatever/ RemoteIPHeader X-Forwarder-For # allows the host to remain RemoteIPInternalProxy XXXX.0.0.0/8 # ip of other machine </VirtualHost>更多推荐
发布评论