How To Install Railo 3.2 Under OpenSUSE 11.3 Running Apache2 Tomcat 6 Virtual Host - Page 3

4. Name Based Virtual Host Configuration In Apache And Tomcat

Suppose I am running name based virtual host ( under apache, and the default DocumentRoot is /srv/www/htdocs.

The virtual host configure file is under /etc/apache2/vhosts.d/internal.conf:

   <VirtualHost *:80 >
       DocumentRoot /srv/www/htdocs
       FileETag INode Size
       ErrorLog /srv/www/htdocs/
       CustomLog /srv/www/htdocs/ combined

To make railo work under the virtual host, we need one more step:

Please change to /opt/railo directory to modify the tomcat configure file server.xml so that the default apache web server root is /srv/www/htdocs, instead of the default tomcat webapps directory.

cd /opt/railo

vi tomcat/conf/server.xml

Around line 143 add the following section:

        <Host name="" appBase="webapps"
             unpackWARs="true" autoDeploy="true"
             xmlValidation="false" xmlNamespaceAware="false">
             <Context path="" docBase="/srv/www/htdocs" />
                <Logger className="org.apache.catalina.logger.FileLogger"/>

Make sure name matches ServerName, and docBase matches DocumentRoot in the apache virtual host configuration file: internal.conf.

Finally, restart railo and apache2, and test whether virtual host works for railo:

/opt/railo/railo_ctl restart

And then create a coldfusion file under /srv/www/htdocs with the following command:

echo "<cfoutput>#now()#</cfoutput>" > /srv/www/htdocs/index.cfm

5. Now Launch Your Browser And Everything Should Work Now

Bingo, it works...

Share this page:

1 Comment(s)

Add comment


From: Luis

Thank you for creating this guide.

 I would like to add something to it if I may. Inside the server.xml file, when you have to add the Host tag, make sure you DO NOT add any slash at the end of the DocBase property, otherwise it will not work. I had days getting a blank page when I was invoking my .cfm page inside my virtual server and I did not know what was going on. Finally, I noticed I had a "/" at the end of the DocBase property value (and it made sense since it is a path after all). Once I removed that "/" everything worked perfectly!

Now I have a great Linux Mint 10 server running with Railo and I cannot be more happy about it.

Thank you again!