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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Virtual Host Question

Status
Not open for further replies.

hdsammy

Technical User
Feb 20, 2003
5
GB
I am running Solaris 5.9 with Apache 1.3.27

I have the default website which is the standard Apache test page and I have added a virtual host to the httpd.conf file. If I use in my browser I get the home page that I am supposed to get but if I use the ip address of the server instead, I get the same home page instead of the default website. If I comment out the virtual host directive in the config file, I get the default page. Is this the way it is suppose to work? I thought that if there was a host header than it would load the virtual host home page and if there wasn't a host header, it would load the default page. Is this question as clear as mud?
 
my config file looks like this:

NameVirtualHost *:3000
<VirtualHost 123.111.222.123:3000>
ServerName 123.111.222.123:3000
DocumentRoot /var/apache/htdocs
</VirtualHost>

<VirtualHost *:3000>
ServerName DocumentRoot /var/apache/htdocs
</VirtualHost>
 
actually my config file looks like this. I left out the mywebsite in my last post on the Document Root:

NameVirtualHost *:3000
<VirtualHost 123.111.222.123:3000>
ServerName 123.111.222.123:3000
DocumentRoot /var/apache/htdocs
</VirtualHost>

<VirtualHost *:3000>
ServerName DocumentRoot /var/apache/htdocs/mywebsite
</VirtualHost>
 
Well guys, it doesn't work. Does anyone have any suggestions. I have tried several differnt configurations with the VirtualHost directives with no success. Could there be something else in my httpd.conf file that could be causing the problem?
 
Ok here's what I had to do to correct the problem:

NameVirtualHost *:3000

<VirtualHost *:3000>
ServerName 127.0.0.1
DocumentRoot /var/apache/htdocs
</VirtualHost>

<VirtualHost *:3000>
ServerName DocumentRoot /var/apache/htdocs/mywebsite
</VirtualHost>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top