Setting up multiple host on one apache 2.2 webserver

This is not the hardest process once it’s running and I am certainly not an expert of Apache settings but I have gotten this to work quite well over the last two years and now here are the settings that work for me.

The first setting can be added under “Listen 80″ if your server runs port 80 of course…

NameVirtualHost *:80

<VirtualHost *:80>
DocumentRoot c:\apache\htdocs\ilertech
ServerName ilertech.com
ServerAlias ilertech.com *.ilertech.com
</VirtualHost>

Uncomment this module for alias to work:

LoadModule vhost_alias_module modules/mod_vhost_alias.so

Note you can run as many websites as you like

<VirtualHost *:80>
DocumentRoot c:\apache\htdocs\ilertech
ServerName ilertech.com
ServerAlias ilertech.com *.ilertech.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot c:\apache\htdocs\othersite
ServerName othersite.com
ServerAlias othersite.com *.othersite.com
</VirtualHost>

<VirtualHost *:80>
DocumentRoot c:\apache\htdocs\onemore
ServerName onemore.com
ServerAlias onemore.com *.onemore.com
</VirtualHost>

Don’t forget to add your sites to your DNS or HOST file

Location of your windows host file:
C:\WINDOWS\system32\drivers\etc\hosts

You may be interested in ...

  • Restart Apache without Dropping Connections (0)
    On a live server when you are restarting apache the last thing you want to do is drop connected clients. Well thankfully apache has a graceful command you can use. From the command prompt: httpd -k restart ...
  • Running IIS and Apache on Port 80 (1)
    I have an IIS website and several apache websites running on the same server. In order to achieve this result I bound IIS to the IP with the method below. You need to have two NIC ports assigned with a static address from your local DNS for this to w...
GD Star Rating
loading...
This entry was posted in Articles and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">