我有一个运行ePages的Centos服务器(在Apache上运行)。 现在我想使用相同的服务器来承载一些其他网站,但我似乎无法让我的configuration工作正常。 我不确定是否有人熟悉史诗(我已经看过他们的论坛无济于事),但这是configuration的epages位:
<VirtualHost _default_:80> <Location /epages/> <IfDefine LB> ProxyPass balancer://cluster/epages/ ProxyPassReverse balancer://cluster/epages/ </IfDefine> <IfDefine !LB> ProxyPass http://myinternal.url:8008/epages/ ProxyPassReverse http://myinternal.url:8008/epages/ </IfDefine> </Location> </VirtualHost>
这就是我所添加的
<VirtualHost my.ip.add.res:80> DocumentRoot /var/www/html/path/ ServerName another.url.com ServerAlias another.url.com </VirtualHost>
现在我的印象是,任何对“another.url.com”的请求都会被添加到我添加的DocumentRoot中,而任何其他的请求都会转到这些epages将要处理的默认值。
然而,不pipe我怎么去服务器,任何指向它的URL,它总是会到我添加的新的虚拟主机,并且永远不会再到世界各地。
如果可能的话,我不想改变epages的configuration,谁能告诉我们这里发生了什么?
还有更多的epagesconfiguration,但不涉及VirtualHosts,所以我没有粘贴它,但如果我需要然后让我知道。
谢谢
我刚刚一直在努力。 不是有趣的吗?
ePages Apacheconfiguration有许多方法与更“正常”的站点不同。
任何带有“zzz”前缀的文件(这是conf.d中的大部分文件)都将被重写,所以不要去编辑这些文件。
如果你看一下conf / httpd.conf,你会看到NameVirtualHost指令被注释掉了。 这意味着你的VirtualHost指令将被IP地址激活,而不是主机名。 所以在你上面的例子中,如果my.ip.add.res碰巧是服务器的默认IP,那么你的VirtualHost块将被忽略,而偏向它之前的那个。 您可以获取第二个IP地址并在第二个VirtualHost中使用(然后为每个需要的新VirtualHost获取一个新的IP),或者取消对NameVirtualHost指令的注释。 但:
这个版本可能会有所不同,但是在我的情况(6.14.3)中,唯一的VirtualHost块位于<IfDefine PROXY>块(conf.d / zzz-epages-httpd.conf)中。 这意味着如果你定义了你自己的VirtualHost,并且你的服务器没有定义一个PROXY环境variables,你的VirtualHost将是唯一的,因此对所有请求都是有效的。 为了安全起见,定义两个虚拟主机:一个用于epages,一个用于其他站点。 如果PROXY被定义,你的史诗VirtualHost将被忽略,否则它将是一个必要的filter。 还要注意,ePages依赖于mod_rewrite,所以这个“安全networking”VirtualHost需要启用它。
这到底是对我有用的东西:
# file: /etc/httpd/conf/httpd.conf # find and uncomment the NameVirtualHost directive, # then add this at the very end of the file <VirtualHost *:80> ServerName www.myepageswebsite.com ServerAlias myepageswebsite.com RewriteEngine On RewriteOptions Inherit </VirtualHost> <VirtualHost *:80> ServerName www.myotherwebsite.com ServerAlias myotherwebsite.com DocumentRoot /var/www/html </VirtualHost>