[英]Redirecting an internal path to a virtual host
我已经在 drupal 测试站点上工作了一段时间,它有一堆这样设置的虚拟主机:
<VirtualHost *:80>
ServerAdmin email@example.com
DocumentRoot "/path/to/root"
ServerName testsite1.example.com
</VirtualHost>
我一直在使用修改后的主机文件来查看每个测试站点,大致如下:
12.0.0.1 localhost 20.02.2.22 testsite1.example.com 20.02.2.22 testsite2.example.com 20.02.2.22 testsite3.example.com
这工作得很好,但是现在我需要将站点发送给一些技术上不足以修改自己的主机文件并以我的方式查看它的人。
Is there a way I could set up Apache so that the url " http://20.02.2.22/testsite1 " would forward to testsite1.example.com internally? 我用的是Drupal,站点设置需要看到“testsite1.example.com”,这样才能正确选择实例到select。 我一直在查看 apache 重写,但我在这方面有点新手,所以非常感谢任何帮助。
testsite1.example.com 只会在你的机器上解析,所以你不能重定向。 您可以使用 mod_proxy 设置代理。 希望这对你有用:
<VirtualHost *:80>
ServerAdmin email@example.com
DocumentRoot "/path/to/root"
ServerName testsite1.example.com
ServerAlias 20.02.2.22
<Location /testsite1/>
ProxyPass http://testsite1.example.com/
</Location>
</VirtualHost>
我展示本地测试站点的方式是动态 DNS 和端口转发的组合。
在内部,我的 Drupal 站点位于 [我的机器 ip] 或 localhost。
我为我的 IP 设置了一个免费的动态 dns 名称,然后在我的路由器上,接受端口上的传入请求以路由到 [我的机器 ip]
这样,他们可以看到 yoursite.dyndns.com,但它正在查看您的本地副本。
为什么您不购买新域名并将其指向您的服务器 IP 地址...或者有免费的域解决方案,例如:
http://www.dot.tk/en/index.html?lang=en
or
http://dyn.com/dns/
如果你想购买新域名,我推荐你这个,便宜又优质的服务: http://server2.elite7hackers.us/recommend.php?site=godaddy
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.