linux – 如何设置VirtualHosts将同一IP上的两个端口指向不同的S
我已经将wiki软件
Gitit设置为在同一个Apache服务器的两个独立端口上运行(端口1848和4000).我已经确认他们正在运行:
http://wcaleb.rice.edu:4000 现在我想将这两个站点代理为更漂亮的URL,如http://wiki.wcaleb.rice.edu和http://hist118.wcaleb.rice.edu.两者的IP地址是128.42.173.84 我的服务器管理员为这些名称添加了DNS条目,但我似乎无法使我的Apache配置工作.在instructions here之后,我试图建立一个像这样的VirtualHost: NameVirtualHost *:1848 <VirtualHost *:1848> ServerName hist118.wcaleb.rice.edu DocumentRoot /var/www/ RewriteEngine On ProxyPreserveHost On ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPassReverse / http://127.0.0.1:1848 RewriteRule ^(.*) http://127.0.0.1:1848$1 [P] ErrorLog /var/log/apache2/error.log LogLevel warn CustomLog /var/log/apache2/access.log combined ServerSignature On </VirtualHost> 另一个类似于端口4000的http://wiki.wcaleb.rice.edu的虚拟主机.但是当我发出服务httpd restart时,我在启动httpd时收到一条FAILED消息,而我的浏览器无法连接到http://hist118.wcaleb.rice.edu. 据我所知,我的httpd.conf的其余部分是发行版附带的默认文件.我的服务器正在RedHat Enterprise机器上运行.我是Apache的新手,所以我确定这里有一个明显的答案,但在尝试对配置进行各种调整后,我无法弄清楚我做错了什么. 解决方法
这是你需要做的.
NameVirtualHost *:80 <VirtualHost *:80> ServerName hist118.wcaleb.rice.edu DocumentRoot /var/www/ RewriteEngine On ProxyPreserveHost On ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPassReverse / http://127.0.0.1:1848 RewriteRule ^(.*) http://127.0.0.1:1848$1 [P] ErrorLog /var/log/apache2/error.log LogLevel warn CustomLog /var/log/apache2/access.log combined ServerSignature On </VirtualHost> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |