linux – 如何设置VirtualHosts将同一IP上的两个端口指向不同的ServerNames?

linux – 如何设置VirtualHosts将同一IP上的两个端口指向不同的ServerNames?,第1张

概述我已经将wiki软件 Gitit设置为在同一个Apache服务器的两个独立端口上运行(端口1848和4000).我已经确认他们正在运行: http://wcaleb.rice.edu:4000 http://wcaleb.rice.edu:1848 现在我想将这两个站点代理为更漂亮的URL,如http://wiki.wcaleb.rice.edu和http://hist118.wcaleb.ric 我已经将wiki软件 Gitit设置为在同一个Apache服务器的两个独立端口上运行(端口1848和4000).我已经确认他们正在运行:

http://wcaleb.rice.edu:4000
http://wcaleb.rice.edu:1848

现在我想将这两个站点代理为更漂亮的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 [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 [P]        ErrorLog /var/log/apache2/error.log        LogLevel warn        CustomLog /var/log/apache2/access.log combined        ServerSignature On</VirtualHost>
总结

以上是内存溢出为你收集整理的linux – 如何设置VirtualHosts将同一IP上的两个端口指向不同的ServerNames?全部内容,希望文章能够帮你解决linux – 如何设置VirtualHosts将同一IP上的两个端口指向不同的ServerNames?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1029186.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存