Problem with Redirect Using Virtual Hosts

Discussion in 'Apache' started by blizzard182, Jan 5, 2007.

  1. #1
    Hello Everybody. I am new in this forums so i will try to explain myself correctly.

    I have apache (2.2.3) running on my PC (Windows as a test environment but it will run in Linux in the final section) and i want to have another web server running also in the same machine.

    I found that this could be easily made using virtual hosts but it doesn´t work for me. I´ve found several pages explaining the use of virtual hosts and i think I have ir right but maybe i am doing some mistake.

    I have apache running ans listenning on the port 80. Also my other web server (Domino) in listenning on the 81. What i want is to people to enter to apache if they put apache.example.com and domino if they put domino.example.com.

    Since I dont have them in our dns, i added them in my hosts file. Both direction pointing to my address.

    I enabled the mod_proxy, http_proxy and mod_rewrite. And here is my code in the vhosts file (The first two were added during install):

    NameVirtualHost *:80
    
    <VirtualHost *:80>
        ServerAdmin webmaster@dummy-host.SEBAS.COM
        DocumentRoot /www/docs/dummy-host.SEBAS.COM
        ServerName dummy-host.SEBAS.COM
        ServerAlias www.dummy-host.SEBAS.COM
        ErrorLog logs/dummy-host.SEBAS.COM-error_log
        CustomLog logs/dummy-host.SEBAS.COM-access_log common
    </VirtualHost>
    
    <VirtualHost *:80>
        ServerAdmin webmaster@dummy-host2.SEBAS.COM
        DocumentRoot /www/docs/dummy-host2.SEBAS.COM
        ServerName dummy-host2.SEBAS.COM
        ErrorLog logs/dummy-host2.SEBAS.COM-error_log
        CustomLog logs/dummy-host2.SEBAS.COM-access_log common
    </VirtualHost>
    
    <VirtualHost *>
    ServerName domino.example.com
    ServerAlias *.domino.example.com
    RewriteEngine On
    RewriteRule ^/(.*) \http://192.168.1.10:81/$1 [P]
    </VirtualHost>
    
    <VirtualHost *>
    ServerName apache.example.com
    ServerAlias *.apache.example.com
    RewriteEngine On
    RewriteRule ^/(.*) \http://192.168.1.10:80/$1 [P]
    </VirtualHost>
    
    
    Code (markup):
    Somehow it worked the first time but after a while testing other configurations, I removed the hosts from my host file and apache continued to show the page. I stopped apache, and the page was still there!! So i thought it was some kind of cache issue.

    I tried to clear the cache. Same result. I tried to connect from another machine. Same result.

    Is there anything wrong?

    Thanks in advance.

    Regards
     
    blizzard182, Jan 5, 2007 IP