class MyApp < Sinatra::Base
set :sessions, true
set :foo, 'bar'
get '/' do
This worked fine when running the application with the rackup command, but in passenger, it just said "not found". Not a very helpful error message at all. There was nothing else on the page (if nginx has an error, it says 'nginx' centred on the page.), so apparently the problem was in sinatra. This is the config.ru file that I had:
require File.join(File.dirname(__FILE__), 'webmain.rb')
Can you see what's wrong? I couldn't either. Apparently no-one else had been dense enough to have this problem on stack overflow or anywhere else I could find with google. After trying different config.ru files and using strace on the nginx and passenger processes, I gave up for the night.
The next evening after getting home from work, I came to a realisation. I changed the config.ru file to this:
require 'rubygems'I needed to actually run the class I created. Success!
root_dir = File.dirname(__FILE__)
require File.join(root_dir, 'webmain.rb')
Note that the File.join stuff is needed because I'm using ruby 1.9, which uses relative paths for "require"s that aren't in the installed directories.
Versions of the software I'm using: