Tips and tricks

The configuration of Railo allows a very granular definition of the behavior of Railo. The default settings are OK, but there are some tricks to add more security or configre it for a clustering environment.

The Railo configuration directory MUST be unique for each web context. This means that two web contexts must never share the same configuration directory. There are unpredictable effects happening when you configure your applicationserver like this.

Renaming the configuration folder

The folder itself has a .htaccess file in it which is respected by Apache but not by IIS obviously. So what you can easily do is just to rename the folder to something non predictable, like THISISTHERAILOCONFIGURATIONFOLDER. You can do this by editing the app-default.xml (this is Resin example so you will have to lookup the corresponding Tomcat or Jetty files) file and change the following line:

<init-param>
<param-name>railo-web-directory</param-name>
<param-value>{web-root-directory}/WEB-INF/railo/</param-value>
<description>Railo Web Directory directory</description>
</init-param>

into

<init-param>
<param-name>railo-web-directory</param-name>
<param-value>{web-root-directory}/THISISTHERAILOCONFIGURATIONFOLDER/railo/</param-value>
<description>Railo Web Directory directory</description>
</init-param>
Moving the configuration folder outside the webroot

This is the easiest way to deal with the access of the Railo configuration folder. Just add another level to your webroot definition. Your corresponding app-default.xml would look like this:

Please note that if your web roots directory are all in the same parent directory then the above configuration would result in storing ALL your Railo configuration directories in the same place which MUST NOT BE DONE. So you would need to do it like this:

Web root parent directory: d:\projects

web root directory definitions:

mywebsite\www

mysecondwebsite\www

By defining the web roots like above the Railo configuration directory get stored one level above the webroot so the distinction between the web contexts remains. 

Webroot Railo configuration directory
mywebsite\www mywebsite
mysecondwebsite\www mysecondwebsite
Making use of the Railo constant {web-context-hash}

This is definitely the most elegant way of doing it and is the solution if you have a clustered environment where two different servers might use the same web root storage in a SAN or NAS.

The definition in the app-default.xml looks like this:

<init-param>
<param-name>railo-web-directory</param-name>
<param-value>c:/webconfig/{web-context-hash}/susi/</param-value>
<description>Railo Web Directory directory</description>
</init-param>

This then ends up in Railo generating the configuration directory below the absolute path in a folder which corresponds to a certain web context hash, a variable provided by Railo and which is individual per web context.