我正在Windows上使用Apache2.2.11(使用WAMP安装)。例如,服务器的IP为3.3.3.3。我的主要Apache安装(apache1)正在监听端口80,并服务于一个网站(www.domain1.com)。我们最近安装了一个具有web发布功能的应用程序,它在内部使用apache (apache2)。我已将该应用程序配置为侦听端口3000。我想通过域名(omething.domain2.com)为第二个应用程序提供服务。
现在,我已经设置了两个DNS条目指向同一个IP。但是,我试图配置主要的apache实例(apache1),以便将端口80上对omething.domain2.com的任何请求重定向到omething.domain2.com:3000(以便它可以被apache2接管)。我首先尝试的VirtualHost配置是
ServerName something.domain2.com Redirect 301 / [http://something.domain2.com:3000/](http://something.domain2.com:3000/) 这不管用。有什么想法吗?
发布于 2011-06-06 17:55:56
您的设置可能/应该可以工作,我想它看起来如下所示:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.domain1.com
ServerAdmin admin@domain1.com
DocumentRoot "/export/htdocs"
ErrorLog "/var/log/apache_error.log"
CustomLog "var/log/apache_access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerName something.domain2.com
Redirect permanent / http://something.domain2.com:3000/
</VirtualHost>如果您发布apache配置以及一些apache日志,这可能是最好的。
还有一个想法:您是否测试过不需要重定向就可以到达http://something.domain2.com:3000/?
发布于 2011-06-06 15:05:47
查看Apache2 2的S mod_proxy:http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
您的vhost看起来可能类似于:
ServerName foo.domain2.com
Order allow, deny
Allow from all
ProxyRequests Off
ProxyPass http://localhost:3000/
ProxyPassReverse http://localhost:3000/https://serverfault.com/questions/277452
复制相似问题