Configuring multiple web sites with Railo 3.1 and Apache 2.2 on Windows

I wanted to do a blog post on how to setup multiple web sites when using Railo 3.1 with Apache 2.2 on Windows as I had to search around a little to find this information when I was setting up my server. In my example, I am running the Windows version of Apache 2.2.13 on a Windows XP box. I'm using Apache instead of IIS to get around the single web site limitation of IIS on Windows XP.

Everyone seems to have their preferred habits when it comes to software installation and data placement on their servers and I'm no different. I like to install all of my server apps; apache, railo, mysql, filezilla, etc in a "server" folder off of the root of my drive. I then like to have a "www" folder off the root of the drive as well with an individual folder acting as the root folder for each of my websites I'm running.

The first step in setting up Apache to run multiple sites in different locations is to modify your httpd.conf file located in the conf directory off of the Apache folder defined during installation of Apache. You will need to uncomment the include statement for the http-vhost.conf file in httpd.conf like so:

# Virtual hosts
Include conf/extra/httpd-vhosts.conf

You then can setup each site in your "www" root folder in the httpd-vhosts.conf file. This file is located in the "extras" folder in your Apache "conf" directory. Here is an example virtual host setup for two sites:

<VirtualHost *:80>
    ServerAdmin webmaster@example.com
    DocumentRoot "D:/www/example.com"
    ServerName www.example.com
    ServerAlias example.com *.example.com
    ErrorLog "logs/example_com-error.log"
    CustomLog "logs/example_com-access.log" combined
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@example.net
    DocumentRoot "D:/www/example.net"
    ServerName www.example.net
    ServerAlias example.net *.example.net
    ErrorLog "logs/example_net-error.log"
    CustomLog "logs/example_net-access.log" combined
</VirtualHost>

You will also need to configure permissions for your new locations outside of the orginal Apache web root like so in your httpd.conf file:

<Directory "D:/www/example.net">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<Directory "D:/www/example.com>
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

Now that you have your httpd.conf and httpd_vhosts.conf files properly setup it is time to modify your resin.conf file which is located in the "conf" folder off of the root of your Railo installation directory. You will need to essential add your virtual hosts in this file for Railo to us like so:

<host id="www.example.com">
    <web-app id="/" root-directory="d:/www/example.com" />
    </host>
    <host id="example.net">
    <web-app id="/" root-directory="d:/www/example.net" />
</host>

Thats all there is to setting up Apache for Windows and Railo 3.1 for multiple web sites in the configuration of your choosing. I appreciate any feedback on these instructions.

 

 

Comments

Write your comment

(it will not be displayed)

Leave this field empty: