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 (www.example.com) 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 >
       ServerAdmin [email protected]
       DocumentRoot /srv/www/htdocs
       ServerName www.example.com
       FileETag INode Size
       ErrorLog /srv/www/htdocs/www.example.com-error_log
       CustomLog /srv/www/htdocs/www.example.com-access_log combined
   </VirtualHost>

To make railo work under the virtual host www.example.com, 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="www.example.com" appBase="webapps"
             unpackWARs="true" autoDeploy="true"
             xmlValidation="false" xmlNamespaceAware="false">
             <Context path="" docBase="/srv/www/htdocs" />
                <Logger className="org.apache.catalina.logger.FileLogger"/>
        </Host>

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)