Forum Moderators: phranque

Message Too Old, No Replies

virtual host configuration

noob can't figure out what the problem is

         

noop

2:06 pm on Oct 4, 2005 (gmt 0)



Hi

I'm running Apache on my ClarkConnect 3.1 box. I have seen and followed a couple of virtual host configuration guides but it's still not working, and I couldn't get any useful advice from the ClarkConnect forum.

I have registered a domain call it 'mydomain.net' and the webserver is serving pages on both my LAN and to external browsers. What I want to do is be able to enter 'http://www.mydomain.net' and get pages from the default web folder, and enter 'http://test.mydomain.net' and be served pages from a different folder.

Here is the relevant code from my httpd.conf:


ServerName www.mydomain.net
ServerName localhost.localdomain
#
Listen 80
#
NameVirtualHost *:80
#
<VirtualHost *:80>
ServerName www.mydomain.net
ServerAlias mydomain.net
DocumentRoot /var/www/html
</VirtualHost>
#
<VirtualHost *:80>
ServerName test.domain.net
ServerAlias *.test.domain.net
DocumentRoot /var/www/html/virtual/test
</VirtualHost>
#
Include conf.d/*.vhost

Also, my hosts file, which I suspect is suffering from overkill on my part:


127.0.0.1 localhost.localdomain localhost www.mydomain.net test.mydomain.net mydomain.net
192.168.1.1 gateway.myname.lan gateway gateway.mydomain.net

(my linux box connects to my LAN via a router)

When I said it wasn't working, what happens is that whatever URL I enter in the form 'http://*.mydomain.net', I always get served index.htm from the default folder (/var/www/html). I am yet to see my test index.htm page, stored in /var/www/html/virtual/test.

I have been restarting Apache between edits, and forcing my browser to refresh. I have tested all my efforts both from my LAN and externally.

I have only registered one A Record (mydomain.net). I have tried specifying CNAMEs of test.mydomain.net targetting mydomain.net, and www.mydomain.net targetting mydomain.net, but nothing seemed to change. Currently I have no CNAMEs specified.

I'd be very grateful for any help you can give me on this. I have searched and searched without finding an answer to what looks to me like a simple problem... hopefully there's a simple solution which my noobness has missed.

Cheers
Noop

noop

1:00 am on Oct 7, 2005 (gmt 0)



anyone?

or is this a non-noobs forum?

jdMorgan

1:30 am on Oct 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



noop,

Welcome to WebmasterWorld!

I don't know what a ClarkConnect is, but this documentation [httpd.apache.org] should be helpful to you.

Jim

noop

9:02 pm on Oct 7, 2005 (gmt 0)



Hi Jim
Clarkconnect is just a gateway built on redhat linux, and is probably irrelevant to this problem. I'm running apache 1.3.33 on it. I have followed several tutorials on setting up virtual hosts and configured my set-up as per the examples I've seen (including at the link you gave me) but I have come up against a brick wall, which is why I posted here.
noop

jdMorgan

9:59 pm on Oct 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd start by chopping out everything that might be interfering. Since Listen 80 is the default, you shouldn't need that. And if you're setting up name-based virtual hosts, I'd be wary of the conflict between your two initial Servername directives and the others, etc.

I'm not very good at these problems, but maybe these previous threads [google.com] may contain something useful.

Jim

noop

4:37 am on Oct 8, 2005 (gmt 0)



Thanks Jim
Amongst those links I found the info I needed. Turned out that my default.conf contained a vhost aliased as *.mydomain.net - this was overriding my test vhost in httpd.conf...
cheers
noop