Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Windows 7 host machine running VirtualBox (v4.122) and a guest VM of Kubuntu 12.04 running Apache2.

I can access the Apache server from the host machine but it will only load the default Apache welcome page and is ignoring all of my virtual hosts.

Some more details about the configuration:

  • The Kubuntu VM has several virtual hosts that all work fine when accessed via a web browser inside the VM.
  • I am using port forwarding in VirtualBox to send port 8080 on the host machine to port 80 on the guest.
  • Both /etc/hosts in Kubuntu and C:\Windows\System32\drivers\etc\hosts have the entries for the local domains and are set to resolve to 127.0.0.1
  • Accessing 'localhost' on the Kubuntu machine will resolve to the directory set in the default vhost (/var/www/) but accessing localhost:8080 servers up the default web page for the server (i.e. "It works ...")

Updated to add output from apache2ctl -S:

     VirtualHost configuration:127.0.1.1:80  is a NameVirtualHost
     default server dghportal.local (/etc/apache2/sites-enabled/dghportal.local:1)
     port 80 namevhost dghportal.local (/etc/apache2/sites-enabled/dghportal.local:1)
     port 80 namevhost local.classtoolkit.org (/etc/apache2/sites-enabled         /local.classtoolkit.org:1)
     wildcard NameVirtualHosts and _default_ servers:
     *:80 is a NameVirtualHost
     default server itechsrv-kuvm1 (/etc/apache2/sites-enabled/000-default:1)
     port 80 namevhost itechsrv-kuvm1 (/etc/apache2/sites-enabled/000-default:1)
     Syntax OK
share|improve this question
    
Can you provide the output of apache2ctl -S? –  Shane Madden Oct 24 '12 at 23:45
    
thanks, Shane -- I've updated the original post with the output –  Alex Oct 24 '12 at 23:51
add comment

1 Answer

up vote 1 down vote accepted

Looks like your custom <VirtualHost> blocks are configured as <VirtualHost 127.0.1.1:80> - this won't ever catch requests from a different host.

The requests from the other device are being caught by the vhost defined at /etc/apache2/sites-enabled/000-default:1 - this is what's causing the welcome page to appear.

Change your vhost definitions from <VirtualHost 127.0.1.1:80> to <VirtualHost *:80>, and you should be all set! You might also want to a2dissite default, so that your sites, not the welcome site, can catch requests to a hostname that doesn't match one of the ones that's already configured.

share|improve this answer
    
Thanks a lot -- I had named the URL in the VirtualHost block (which is what was causing it to resolve to 127.0.0.1) but I replaced it with the wildcard and access from the host machine is working now. –  Alex Oct 25 '12 at 5:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.