Rob Wood wrote:
Greetings,
I have been having major problems with Apache, running a main server and two virtual hosts.
I have been through the Apache documentation with a fine tooth comb and as far as I can see my cofiguration should work. It works OK when accessing the main server from outside, but when I try to access the virtual hosts, they all default to the main server.
The best I have managed so far is to run the main server and 1 virtual host, using the _default_vhost directive on a separate port. With this setup, I managed to access 2 of the sites, but then that leaves 1 site out of the setup.
Assuming that the first 2 sections of the httpd.conf are correct, as it is as the default except that I entered the basic main server information, then the 3rd section, Virtual Hosts must be causing the problem.
I have therefore attached the VHost section of the httpd.conf to keep the e-mail concise. If anyone can point me in the right direction I would be grateful.
I have unfortunately had to run my commercial site on Win2000 and IIS to stay online for now so none of my 3 sites can be accessed via Apache just now.
Woodsey
------------------------------------------------------------------------
###### SECTION 3 VIRTUAL HOSTS ######
############################################################################
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at # <URL:http://httpd.apache.org/docs-2.0/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.
#
#
#Use name-based virtual hosting.
NameVirtualHost *:80
NameVirtualHost 192.168.1.9:80
NameVirtualHost 192.168.1.9:80
NameVirtualHost 192.168.1.9:80
NameVirtualHost 192.168.1.9
#<VirtualHost *>
#
###### VIRTUAL HOST 00 NO KNOWN SERVER NAME ######
#
<VirtualHost *:80>
ServerAdmin [EMAIL PROTECTED]
ServerName website01.domainA.com
DocumentRoot "F:/websites/website01"
</VirtualHost>
ServerSignature email
DirectoryIndex index.php index.html index.htm index.shtml
LogLevel warn
HostNameLookups off
</VirtualHost> (You don't need port 80, it's the default)
#Oy! Woodsey! No! Wot's this F: stuff? And the domain names should be lower case.
###### VIRTUAL HOST 01 ######
#
<VirtualHost 192.168.1.9:80>
ServerAdmin [EMAIL PROTECTED]
ServerName website01.domainA.com
ServerAlias website01.domainA.com www.website01.domainA.com
DocumentRoot "F:/websites/website01"
ErrorLog logs/log01/error.log
CustomLog logs/log01/access.log
</VirtualHost>
<VirtualHost website01.domaina.com>
DocumentRoot /websites/website01
ServerAdmin [EMAIL PROTECTED]
ServerName website01.domaina.com
ServerAlias www.website01.domaina.com
</VirtualHost>
( Add the logs if you want. )This will be the default target, as the * Virtual domain is setting up the environment, but not providing any pages to serve.
Also, website01.domaina.com and www... must resolve. Either modify your dns server, or update the /etc/hosts file to ensure they both resolve to 192.168.1.9. You need to do that on the server, otherwise apache won't start, and on the client ( if it's a different machine ) otherwise you'll never get an anwser.
Modify the rest in a similar way.
I've got a copy of O'Reilly's Apache - the definitive guide ( Laurie & Laurie ) if you want to borrow it. From the days when I had money (:
Work in town, corner of Salisbury and Victoria, near the cheesemongers ( and not next door for those of you who know the area well! ).
Give us a shout if it's of any use and I'll bring it in tomorrow.
Cheers,
Steve
#
###### VIRTUAL HOST 02 ######
#
<VirtualHost 192.168.1.9:80>
ServerAdmin [EMAIL PROTECTED]
ServerName website02.domainB.com
ServerAlias website02.domainB.com www.website02.domainB.com
DocumentRoot "F:/websites/website02"
ErrorLog logs/log02/error.log
CustomLog logs/log02/access.log
</VirtualHost>
#
#
###### VIRTUAL HOST 03 ######
#
<VirtualHost 192.168.1.9:80>
ServerAdmin [EMAIL PROTECTED]
ServerName website03.domainC.com
ServerAlias website03.domainC.com www.website03.domainC.com
DocumentRoot "F:/websites/websiteC"
ErrorLog logs/log03/error.log
CustomLog logs/log03/access.log
</VirtualHost>
#
#
###### VIRTUAL HOST 04 ######
#
------------------------------------------------------------------------
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.1 - Release Date: 19/01/2005
