If you have followed the instructions in the previous post then you hopefully have a working Railo server. Next step is to set up a website.
There are three main steps required
1) Add the site domain name to your hosts file
2) Add the site to apache
3) Add the site to tomcat
Let’s set up a Railo site at the address http://test.localhost
In these notes I am using the nano editor. If you are in a graphical environment then you can substitute all references to nano with gedit, which is a nice graphical editor.
Enable index.cfm as a default file in Apache
First let’s ensure that index.cfm is a default file in Apache.
httpd.conf is the place to put your custom configuration
sudo nano /etc/apache2/httpd.conf
Add in the text
DirectoryIndex index.cfm
Ctrl O, Enter – to Save
Ctrl X, Enter – to Exit
Update your hosts file
sudo nano /etc/hosts
Add in the line
127.0.0.1 test.localhost
Ctrl O, Enter – to Save
Ctrl X, Enter – to Exit
Create the new site
cd /var/www sudo mkdir test cd test sudo nano index.cfm
Enter the text
<cfoutput> The time is #now()# </cfoutput>
Ctrl O, Enter – to Save
Ctrl X, Enter – to Exit
Add the site to Apache
cd /etc/apache2/sites-available sudo nano test
Enter the following
<VirtualHost *> ServerName test.localhost DocumentRoot /var/www/test </VirtualHost>
Ctrl O, Enter – to Save
Ctrl X, Enter – to Exit
Enable the site. The command a2ensite creates a link in the /etc/apache/sites-enabled directory.
sudo a2ensite test
Add the site to Tomcat
cd /opt/railo/tomcat/conf sudo nano server.xml
Go to the very end of the file and enter the following just before the closing tag.
Notice that this is a copy of the commented out >Host< entry with the [ENTER DOMAIN NAME] and [ENTER SYSTEM PATH] completed.
<Host name="test.localhost" appBase="webapps" unpackWARS="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false"> <Context path="" docBase="/var/www/test" /> </Host>
Ctrl O, Enter – to Save
Ctrl X, Enter – to Exit
Restart Apache and Railo
sudo /etc/init.d/apache2 restart sudo /etc/init.d/railo_ctl restart
Check your site is working
Go to http://test.localhost

2 Comments
Looks like you forgot to escape the greater-than/lesser-than symbols for your Tomcat host.
Thanks Tom, fixed.