Friday, January 21, 2011

I run Webmin and I want it to be accessed with two URLs, both using proxypass in apache

This is what I am trying to do:

NameVirtualHost *
<VirtualHost *>
        ServerName testsite.org
        ServerAdmin webmaster@testsite.org
        DocumentRoot /var/www/
</VirtualHost>

<VirtualHost *>
        ServerName panel.testsite.org
        ProxyPass / http://panel.testsite.org:10000/
        ProxyPassReverse / http://panel.testsite.org:10000/
</VirtualHost>

<VirtualHost 12.34.56.78>
        ServerName newsite.com
        ServerAdmin webmaster@newsite.com
        DocumentRoot /var/newsite/
</VirtualHost>

<VirtualHost 12.34.56.78>
        ServerName panel.newsite.com
        ProxyPass / http://panel.newsite.com:10000/
        ProxyPassReverse / http://panel.newsite.com:10000/
</VirtualHost>

The problem is that it won't accept the 2nd vhost with the IP 12.34.56.78 because it says one already exists. panel.newsite.com and newsite.com have the same IP...so I am not sure how I can make it so that only the URL "panel.newsite.com" will get proxypassed to port 10000 but no other URL on newsite.com

  • Virtual host doesn't really apply to multiple instances of the same ip addresses. You don't need to use the specific IP, when your "NameVirtualHost" is already *.

    Try:

    <VirtualHost *>
            ServerName newsite.com
            ServerAdmin webmaster@newsite.com
            DocumentRoot /var/newsite/
    </VirtualHost>
    
    <VirtualHost *>
            ServerName panel.newsite.com
            ProxyPass / http://panel.newsite.com:10000/
            ProxyPassReverse / http://panel.newsite.com:10000/
    </VirtualHost>
    

    If the virtual host directive isn't unique (or a wildcard), then the config just defaults to the first match, which is why it's not going past the first one, since the IP is overriding the ServerName.

    : This way works and allows me to access the newsite webmin correctly. However, when I access http://newsite.com:10000 it relocates to http://panel.testsite.org/
    : I take that back, it loads the wrong page now...
    : This did not work for a solution, it wouldnt load any pictures from newsite.com..they would come as a 404 error on testsite.org...

0 comments:

Post a Comment