Documentation Home

Contents

Adding Sites

Adding sites to Linux when working with the installer can be summarized in two quick steps:

  1. Add site to Apache
  2. Add site to Tomcat server.xml

The "Add site to Apache" part is usually taken care of by your control panel (since most linux hosting account use them), but it can be added manually. Adding a site to Tomcat's server.xml file is a little more tricky, but can be done relatively easy once you're familiar with it.

Apache Configuration

The installer should configure a pretty well-rounded default Apache install. The installer works by directly modifying the main Apache configuration file (usually httpd.conf or apache2.conf), and adds the mod_jk configuration to the end of that document. This configuration is required.

With Linux installations that contain a control panel, such as VirtualMin, cPanel, or Kloxo, for example, this is usually alright as adding new sites to your server using these control panels will NOT update the main Apache config file. Instead, these control panels simply put an include into the main Apache config file, and add their configs via their included files. However, in some cases, like adding a new processing module to Apache in cPanel for example, cPanel will recompile Apache and rewrite the main Apache config file. In those circumstances, the Apache configuration will need to be added to the main Apache config file again.

So, should that kind of a situation happen to you, here is the current (as of 3.2.2.000 Pl0) default Apache configuration - be sure to note the places where [module directory] and [log directory] are stated. You will need to place the correct directory locations there:

 <IfModule !mod_jk.c>
    LoadModule jk_module [modules directory]/mod_jk.so
 </IfModule>

 <IfModule mod_jk.c>
    JkMount /*.cfm ajp13
    JkMount /*.cfc ajp13
    JkMount /*.do ajp13
    JkMount /*.jsp ajp13
    JkMount /*.cfchart ajp13
    JkMount /*.cfm/* ajp13
    JkMount /*.cfml/* ajp13
    # Flex Gateway Mappings
    # JkMount /flex2gateway/* ajp13
    # JkMount /flashservices/gateway/* ajp13
    # JkMount /messagebroker/* ajp13
    JkMountCopy all
    JkLogFile [log directory]/mod_jk.log
 </IfModule>

Apache Default Document

The Apache version of mod_jk is quite nice because default documents work without any additional configuration. With the above configuration in place, you can set your default document, in any directory, as index.cfm and Apache will properly pas off the request to Tomcat because of the Above config that maps anything ending in ".cfm" off to Tomcat ("ajp13").

For those of you who want to set the default document by hand, here's an example directive:

 DirectoryIndex index.cfm index.cfml index.html index.php index.xhtml index.htm default.htm

Tomcat Configuration

Configuring Tomcat is nearly identical to configuring Apache, but since not as many folks use Tomcat, there's generally no control panel support for adding hosts to Tomcat. So, we're down to configuring Tomcat by hand.

The default location of the server.xml file is /opt/railo/tomcat/conf/server.xml. The file has been commented (look near the bottom) and read the comments carefully. You should see something like this:

      <!-- Define the default virtual host
           Note: XML Schema validation will not work with Xerces 2.2.
       -->
      <Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
      </Host>

      <!--
        Add additional VIRTUALHOSTS by copying the following example config:
        REPLACE:
        [ENTER DOMAIN NAME] with a domain, IE: www.mysite.com
        [ENTER SYSTEM PATH] with your web site's base directory. IE: /home/user/public_html/ or C:\websites\www.mysite.com\ etc...
        Don't forget to remove comments! ;)
      -->
      <!--
        <Host name="[ENTER DOMAIN NAME]" appBase="webapps"
             unpackWARs="true" autoDeploy="true"
             xmlValidation="false" xmlNamespaceAware="false">
             <Context path="" docBase="[ENTER SYSTEM PATH]" />
             <Alias>[ALTERNATE DOMAIN NAME]</Alias>
        </Host>
      -->

     </Engine>
   </Service>
 </Server>

So, adding a new host would look something like this (we're going to get rid of all the superfluous stuff):

       <Host name="getrailo.org" appBase="webapps">
             <Context path="" docBase="/home/admin/getrailo.org" />
	     <Alias>www.getrailo.org</Alias>
       </Host>

     </Engine>
   </Service>
 </Server>

Once you've updated your server.xml file, restart Tomcat/Railo and you should be all set!

 sudo /etc/init.d/railo_ctl restart

Documentation Home