I installed Ubuntu Server 10.10 on VmWare. I installed apache and php and then created a virtual directory, following these steps: http://www.phpfreaks.com/tutorial/a-simple-debian-based-dev-environment

So, I now have a V-host foo.local. I wanted to see the results on my Win7 host, so I checked the IP-address with ifconfig and went there. Sadly, I'm only getting the standard "It Works" page. How can I view my vhost?

EDIT: when I say "Virtual host", I mean the PHP website. I do not mean my Guest OS Ubuntu Server. That is the Virtual Machine, on which the Virtual Host is running.

I can reach the Machine, I can't reach the specific host on it.

EDIT2: solved. I initially thought this wouldn't work. Adding the line to the hosts file did it, I was under the impression that all the hosts file does is redirect something to an IP-address. So if I'm going to manually or telling the hosts file that foo.local points to it, I thought there would be no difference, because Win7 doesn't know what's on the Ubuntu Server. Only that it exists... oh well...

  • 1
    You are viewing your vhost. What other result do you expect?
    – Sven
    Jan 30 '11 at 18:54
  • @SvenW: The phpinfo() result of the index.php file I set, as per the guide I used which is linked in the post.
    – KdgDev
    Jan 30 '11 at 18:58
  • can you edit your post and add the contents of the conf files you have in /etc/apache2/sites-enabled/ and the URL you are using to connect to the server please.
    – user9517
    Jan 30 '11 at 19:28

Did you restart apache as per instructions? After adding the vhost?

If you did everything else, and are seeing standard index.html vs index.php it could be that apache is not restarted.

If Apache is restarted, did you add foo.local as a resolvable host in your windows 7 machine? Its a step in the howto as well, but it assumes you are on linux.

If you didn't, and are just going there by IP - then you are getting the default site, and not your newly created foo.local. You need to add foo.local on Win7 to point to the ip you looked up. http://helpdeskgeek.com/windows-7/windows-7-hosts-file/

  • That did it. I didn't do it because I didn't think it would work. To add in the host file is to just redirect to an ip address. I'd be redirecting to the same IP and I thought I'd end up at the same place again.
    – KdgDev
    Jan 30 '11 at 20:10

Did you enter an entry in your hosts file? It sounds like you went directly to your IP which won't bring up the Vhost, it will use the main site instead.

Enter this into your host file foo.local and the IP of the VM.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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