[英]IIS 7.5 ARR/URL ReWrite2 ReversProxy to Apache on Virtual Machine
Here's the scenario. 这是场景。
Server is Win2k8, running IIS 7.5. 服务器是Win2k8,运行IIS 7.5。 I have ARR and URL Rewrite2 installed.
我安装了ARR和URL Rewrite2。
I have a virtual box running the latest Ubuntu Server. 我有一个运行最新版Ubuntu Server的虚拟机。 Apache, mySQL, PHP are all installed.
Apache,mySQL,PHP均已安装。
I have IIS configured as a reverse proxy, and have setup a URL ReWrite as such: 我已将IIS配置为反向代理,并设置了URL ReWrite,如下所示:
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="false">
<match url="(.*)" />
<action type="Rewrite" url="http://192.168.1.17/{R:1}" />
</rule>
</rules>
</rewrite>
I have verified that http://dev.o7t.in correctly gets routed to the configured site in apache on the VM, however, http://wp.o7t.in gets directed to the same exact place. 我已验证http://dev.o7t.in正确地路由到了VM上apache中的已配置站点,但是, http: //wp.o7t.in却被定向到了相同的确切位置。 Here's the config from both sites in apache:
这是apache中两个站点的配置:
Dev: 开发人员:
# NameVirtualHost *:80
<VirtualHost *>
ServerName devo7tin
ServerAlias dev.o7t.in
ServerAdmin support@o7t.in
DocumentRoot /var/www/dev/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/dev/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
wp: wp:
# NameVirtualHost *:80
<VirtualHost *>
ServerName wpo7tin
ServerAlias wp.o7t.in
ServerAdmin support@o7t.in
DocumentRoot /var/www/wordpress/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/wordpress/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
and NameVirtualHost is configured already in ports.conf 并且已经在ports.conf中配置了NameVirtualHost
What I am noticing is the Host Header, always reverts to the IP address of the virtual machine (in this case 192.168.1.17), and completely ignores the requested host. 我要注意的是主机头,它总是恢复为虚拟机的IP地址(在这种情况下为192.168.1.17),并且完全忽略了请求的主机。
So.... how can I get around this, and pass my VM the correct HTTP_HOST header? 所以...。如何解决这个问题,并将正确的HTTP_HOST标头传递给我的VM?
I was right. 我是正确的。 It was an IIS thing not sending the HTTP_HOST header.
IIS没有发送HTTP_HOST标头。 Of course, why would they post it anywhere, but apparently ARR by default disables, however, it can be enabled via:
当然,为什么他们要在任何地方发布它,但是显然ARR默认是禁用的,但是可以通过以下方式启用它:
appcmd.exe set config -section:system.webServer/proxy /preserveHostHeader:"True" /commit:apphost
Configured this, and it now works! 配置了它,现在可以使用了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.