从现有域重定向到新域(Apache / haproxy)

编程入门 行业动态 更新时间:2024-10-27 05:30:10
本文介绍了从现有域重定向到新域(Apache / haproxy)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

说明:我们有两台apache服务器,其中一台在haproxy之后。我们的新服务器位于haproxy盒后面,旧服务器位于另一个网络上。我将创建一个Apache重写规则,以将该oldsite/some/thing指向新的haproxy框(如下所示)。这将重定向到newsite /一些/其他东西。

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/some/thing to the new haproxy box (as seen below). This will redirect to newsite/some/other thing.

问题:是否可以使用户透明?我希望用户只看到oldsite/some/thing而看不到newsite / some / other / thing?用haproxy可以做到吗?我对haproxy了解得很少,但了解得很少。在此先感谢您的时间。

QUESTION: Is it possible to make this transparent to the user? I would like the user to only see oldsite/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(amazon AMI)。如上所示,我想使第二台服务器对用户透明。

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
  • (用户从未看到过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 ^/(.*) login.DESTINATION.info/$1 [P,L] </VirtualHost>

最终服务器处理请求:

<VirtualHost *:80> ServerName login.DESTINATION.info ServerAdmin webmaster@site 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>

更多推荐

从现有域重定向到新域(Apache / haproxy)

本文发布于:2023-10-31 17:26:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546769.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:到新   重定向   haproxy   Apache

发布评论

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

>www.elefans.com

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