Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Goodday,

First of all i'm very green when it comes to server related stuff so bear with me. I'm running ubuntu 11.10 and I have installed an apache tomcat railo stack on my server using https://github.com/talltroym/Railo-Ubuntu-Installer-Script/blob/master/setup-railo.sh

So far everything is fine and the server works perfectly, however I seem to be at a loss as to how to configure multiple websites. Right now every connection seems to be going to /var/www/.

I've tried adding a new vhost in apache which worked perfectly apart from the fact that it was just outputting my cfml files and not passing through the railo server.

I'm thinking this is due to the fact that it needs to be told that railo needs to handle this, after some research I found this line in the available-sites/default-ssl file:

DirectoryIndex index.cfm index.cfml default.cfm default.cfml index.htm index.html
#Proxy .cfm and cfc requests to Railo
    ProxyPassMatch ^/(.+.cf[cm])(/.*)?$ http://127.0.0.1:8080/$1
    ProxyPassReverse / http://127.0.0.1:8080/

after copying these lines into the new vhost railo seemed to be activating correctly but was running from /var/www and not the directory I had set in the vhost.

My new vhost looks like this:

<VirtualHost *:80>
 DocumentRoot "/var/www/test"
 ServerName -hidden-
 <Directory "/var/www/test">
 allow from all
 Options +Indexes
 </Directory>
    DirectoryIndex index.cfm index.cfml default.cfm default.cfml index.htm index.html
    #Proxy .cfm and cfc requests to Railo
            ProxyPassMatch ^/(.+.cf[cm])(/.*)?$ http://127.0.0.1:8080/$1
            ProxyPassReverse / http://127.0.0.1:8080/
    #Deny access to admin except for local clients
    <Location /railo-context/admin/>
            Order deny,allow
            Deny from all
            Allow from 172.16.0.0/16
            Allow from 192.168.0.0/24
    </Location>
 </VirtualHost>

I could use some pointers as to where I need to change things for this to work. Cheers!

share|improve this question

1 Answer 1

up vote 0 down vote accepted

The Tomcat instance which Railo is running in is also configured to /var/www; it's this line in /opt/tomcat/conf/web.xml:

<Context path="" docBase="/var/www"/>

But, if you just change that to the /var/www/test directory, then the items in the main site will stop working. Instead, work with the directory structure that you're building with sub-directories for each site. Change your proxy directives in the new vhost:

ProxyPassMatch ^/(.+.cf[cm])(/.*)?$ http://127.0.0.1:8080/test/$1
ProxyPassReverse / http://127.0.0.1:8080/test/

This directory structure also means that someone can get to the test site via http://main-site.name/test/, so be aware of this; it might be a good idea to move its documents under /var/www/main/ or something, and adjust its proxy statements accordingly as well.

share|improve this answer
    
Cheers that worked perfectly! I moved everything into its own folders now. –  Thomas Van Nuffel Feb 5 '12 at 13:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.