[Hampshire] Apache virtual hosts

Top Page

Reply to this message
Author: Stephen Davies
Date:  
To: Hampshire LUG Discussion List
Subject: [Hampshire] Apache virtual hosts
Can anyone recommend a good reference/step-by-step guide for setting up
the httpd.conf file so that virtual hosts work properly.

I've done this a few times in the past but more by luck than judgement,
I have gotten it to work. Now I really need to understand it once and
for all and then document it properly.

The thing I'm trying to do is setup a server where I have seperate urls
for the following

    wordpress
    joomla
    gallery2
    general web site


phpmyadmin must also work. using "http://localhost/phpMyAdmin"

In the testing environment, I have created the DNS names in DynDns that
all point to external facing IP address which get routed to the Linux
server where all this will be hosted.


The problems I'm having is that I can get to the server via a name such
as myblog.homelinux.org but all I get is the default homepage even
though I have used the DocumentRoot inside the VirtualHost option.
This is all being added to an existing & live site so I want to test it
all on another machine first.

Here is the relevant bits of the httpd.conf
(I'm using port 60163 for testing through my router)

NameVirtualHost *:60163

<VirtualHost *:60163>
    DocumentRoot /var/www/html
</VirtualHost>


<VirtualHost 127.0.0.1:60163>
    DocumentRoot /var/www/html
    ServerName  localhost
</VirtualHost>


<VirtualHost myblog.homelinux.org:60163>

    DocumentRoot  /data1/myblog/
    ServerName myblog.homelinux.org
</VirtualHost>


etc

I can get at the myblog by specifying the myblog at the end of the url.
It appears therefore that the DocumentRoot stuff is not working.

Any Ideas?

Stephen D