[TriLUG] Using Apache 2 with Multiple domains

Aaron S. Joyner aaron at joyner.ws
Thu Jul 8 22:52:04 EDT 2004


Mark Fowle wrote:

> All - I am trying to have multiple domains on a single IP -  I have 
> read the apache docs but still am not sure how to set this up.
> Does anyone have any good references or how-to's for Apache 2 and 
> multiple domains (including the DNS resolutions)?
>
> What I am trying to do is to have two domains on 1 ip - 
> www.thissite.com  and www.anotherone.net  (examples ....) both on 
> 24.156.43.45
> I need to have both be able to have email too....
>
> I can't seem to understand how to do this based on the docs and an 
> older how to I referenced on the web...  Any help would be appreciated!
>
> Thanks,
> Mark
>
# This directive tells Apache to turn on "name based virtual hosting", i.e.
# directing of requests based on the name the page was requested as
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
#
#<VirtualHost *>
#    ServerAdmin webmaster at dummy-host.example.com
#    DocumentRoot /www/docs/dummy-host.example.com
#    ServerName dummy-host.example.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

<VirtualHost *:80>
    ServerAdmin me at example.com
    DocumentRoot /home/thissite/www
    ServerName www.thissite.com
    ServerAlias thissite.com
    ErrorLog logs/thissite-error_log
    CustomLog logs/thissite-access_log common
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin me at example.com
    DocumentRoot /home/anotherone/www
    ServerName www.anotherone.net
    ServerAlias anotherone.net
    ErrorLog logs/anotherone-error_log
    CustomLog logs/anotherone-access_log common
</VirtualHost>

Email, on the other hand, is a whole different story.  :)  Get Apache 
working, then ask again about Email, or check the archives -- both 
questions have been answered numerous times before.  :)

Aaron J.



More information about the TriLUG mailing list