views:

19

answers:

0

I wrote a simple Sinatra application with two "routes": "/show" and "/listshows". When I run the application on top of Webrick, everything works beautifully for both the static and non-static routes. Here are the URL's that I use:

Today, I deployed my simple application on top of Apache and Passenger 2. My web server is on my private network and is named Millhouse. I basically want to access the application using the following URLs:

The probem is that the "slwa" string isn't part of any of my URL's. For example, when you try to visit "http://millhouse/slwa", you should be automatically redirected to "http://millhouse/slwa/listshows". While my app does redirect, it ends up sending me to "http://millhouse/listshows". The "slwa" part is missing.

I didn't want to create a new virtual host, so I reused the "root" virtual host on my Ubuntu server. Here's my virtual host:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>
    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

    ### Here's the only line that I added to the default
    RackBaseURI /slwa
</VirtualHost>

I also created a symlink under /var/www that points at the public dir for my app. And finally, here's my config.ru:

# This is straight from the Phusion Passnger Users Guide"
require 'rubygems'
require 'sinatra'

root_dir = File.dirname(__FILE__)

set :environment, ENV['RACK_ENV'].to_sym
set :root,        root_dir
set :app_file,    File.join(root_dir, 'slwa.rb')
disable :run

require 'slwa'
run Sinatra::Application

What part am I missing?

Thanks in advance for any help!

Tom Purl

related questions