[CentOS] virtual host on latest centos 4.4

Fri Oct 6 09:12:38 UTC 2006
JT Justman <jt at signless.com>

Mark Fitzsimmons wrote:
> Good morning All,
> 
> I have a slight issue with apache virtual hosts not working on my newly
> installed CentOS (4.4).

I doubt this is a CentOS problem. Consider this:

http://www.catb.org/~esr/faqs/smart-questions.html#forum

I will nonetheless try to help you.

> I am very new to Linux, however I have experience with apache etc on
> 'w1nd0ws'. I've been round and round in the apache conf file and to no
> avail. 
> 
> Basically if I setup a virtual host the default then looks at it. Also,
> if I setup multiple virtual hosts they all look at the first virtual
> host.

The first vhost is supposed to be the default. The subsequent vhosts are
used if the requested URI reported by the browser matches a ServerName
or ServerAlias directive. If none matches, the first is used.

> I'm running the machine inside my local network as a staging server for
> web design. I then set my HOSTS file on my PC to the ip of the server
> and then the www.domain.co.uk:
> 
> Eg:
> 192.168.1.250	www.testsiteonvirtualhost.co.uk
> 
> This is what I do on my other apache test server (not CentOS). I assume
> this should work??

I think so. Entering that site into the address bar of your browser
should bring up the corresponding vhost.

Try running the 'apachectl -S' command. This will give you information
about your vhosts, and check the syntac of your apache configuration.

> Is there anything other than virtual hosts that would need setting up?? 

That's a very broad question ;P

You might want to be sure that you know what's being called from the
/etc/httpd/conf.d/ configuration files. I don't know what the default
CentOS files look like, but sometimes there's a 'vhosts.conf' file in
there that might be confusing things.

JT