Try this config.ru:
require 'rubygems'
require 'sinatra'
set :environment, ENV['RACK_ENV'].to_sym
set :app_file, 'app.rb'
disable :run
require 'app'
run Sinatra::Application
> My httpd.conf contains:
> ------------------------------------------------------------------------------------------
>
> # Sinatra host
> <VirtualHost *:80>
> ServerName localhost:8080
> DocumentRoot /var/www/app/public
> RackBaseURI /app
> </VirtualHost>
> ------------------------------------------------------------------------------------------
>
Try changing your DocumentRoot to /var/www
In this case passenger tries to find a symlink inside /var/www that is
named app and points to your public folder.
> Note: /var/www/app is a sym link of /home/user/code/app. Don't know
> if it matters or not, but that's how I'd like it setup.
Change your symlink to point to the public folder
ln -s /home/user/code/app/public /var/www/app
Note that when using sinatra modular design or when using RackBaseURI
you also get a root path which is empty.
get '' do
"Hello roootlessss"
end
This can be fixed with a little before filter:
before do
request.env['PATH_INFO'] = '/' if request.env['PATH_INFO'] == ''
end
or you can do this:
before do
request.env['PATH_INFO'].gsub!(/\/$/, '')
end
This removes trailing / from all requests and you can use only a "get
'' do" for root.
Cheers
Mathias Stjernstrom
-------------------------------------------
http://www.pastbedti.me/
If you have that before block you'll rewrite "" to "/".