How do I setup VirtualHosts to point two ports on same IP to different ServerNames?

若如初见. 提交于 2019-12-05 11:19:30

This is what you need to do.

    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>

Remove the :1848 (or change it to :80) on your NameVirtualHost and VirtualHost. The whole point of this exercise is to have Apache listen on the default HTTP port (port 80) for these hostnames and proxy traffic to the high ports that Gitit is listening on.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!