[Techtalk] Hosting multiple websites from one user on Apache

leslie at freakybutt.net leslie at freakybutt.net
Thu Jan 10 04:06:46 EST 2002


On Wed, 9 Jan 2002, Amber wrote:

> Hey all, I have been poking around with this for a few days now, and
> haven't gotten it to work quite right yet. Does anyone know what has to
> be done in httpd.conf to get more than one site hosting off of a users
> directory? I am setting the document root as just another folder in my
> home directory, but that doesn't work. Is there a specific way I have to
> reference it? Or a specific location it has to be in? Would appreciate
> any suggestions.
>
> Thanks,
> Amber
>

Are you pulling up the same website for all of the hosts? If so it sounds
like is that you do not have NamVirtualHost specified in your 
httpd.conf. If you do not have NameVirtualHost while hosting websites on
the same IP address when pulling up a website on that IP address apache
will pull up the first VirtualHost in the httpd.conf that pertains to that
IP Address.

Here is a portion of my httpd.conf that should help you with your problem

<snip>

### 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://www.apache.org/docs/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 *
NameVirtualHost *:443

</snip>

What the NameVirtualHost does is listen on a certain IP address or IP
address and port. The first NameVirtualHost * tells apache to listen on
all IP's if you just want it to listen on a specific IP you can replace
the asterisk for the IP address. The second line NameVirtualHost *:443
tells apache to listen on all IP addresses on the port 443. I use this for
SSL. 

Hope this helps you out, if not just let me know and I'll see what else I
can do. :)

- Leslie




More information about the Techtalk mailing list