Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Virtual Hosts I'm stumped

Status
Not open for further replies.

scatcat

Programmer
Oct 17, 2002
4
GB
Hi everyone,

I am running Apache on NT. I am trying to set up virtual hosting on my workstation. It's IP address is 10.1.2.95
In the hosts table I have two names belonging to that address Server1 and Server2. I am trying to set up Virtual hosts:

ServerName Server1
NameVirtualHost 10.1.2.95

<VirtualHost 10.1.2.95>
ServerName Server1
DocumentRoot &quot;E:/blar/HTTPServer/htdocs&quot;
Alias / E:\blar\Server1\html\enter.html
</VirtualHost>

<VirtualHost 10.1.2.95>
ServerName Server2
DocumentRoot &quot;E:/Site2&quot;
Alias / E:\Site2\index.html
</VirtualHost>

DirectoryIndex index.html enter.html

The problem is if I put or into a broswer it will only show Server2's content for both sites. I have tried changing the directories where enter and index.html live, but nothing seems to make a diffrence. I have read so many FAQs and tips all over the place but I cannot resolve this. It's driving me mad!

Can anyone shed any light on this please?
 
Thanks for the help everyone.

I have sussed it. Apache in this case is part of an IBM application and that made things a bit more complicated. So I was being a bit naive thinking it would work as expected, i.e. normal Name-Based hosting, and that's what's thrown me.

What I needed to do was this :

NameVirtualHost 10.1.2.95

<VirtualHost 10.1.2.95>
ServerName Server1
all the bits in here
</VirtualHost>

<VirtualHost 10.1.2.95:443>
ServerName Server1
all the bits in here
</VirtualHost>


<VirtualHost 10.1.2.95>
ServerName Server2
all the bits in here
</VirtualHost>

And that finally worked. What I was missing was the fact that IBM had loaded a SSL module onto Apache, and it was this that was causing all the problems. Once I commented that out Name-Based hosting worked exactly as the FAQ suggested (thanks for that). So that got me thinking, I finally came up with that config that worked.

Once again thanks for your help everyone.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top