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 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 192.168.53.84 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...

share|improve this question
1  
You are viewing your vhost. What other result do you expect? –  SvW 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. –  Iain Jan 30 '11 at 19:28

2 Answers 2

up vote 1 down vote accepted

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/

share|improve this answer
    
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.

foo.local 192.168.1.1

share|improve this answer

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.