The Camping Server for Apache + FastCGI
- Install Apache 2.
- Install mod_fastcgi.
- Add to Apache's httpd.conf:
AddHandler fastcgi-script rb ScriptAlias / /usr/local/www/data/dispatch.rb/
- In dispatch.rb:
#!ruby #!/usr/local/bin/ruby require 'rubygems' require 'camping/fastcgi' Camping::Models::Base.establish_connection :adapter => 'sqlite3', :database => "/tmp/camping.db" Camping::FastCGI.serve("/usr/local/data/examples/")
Serving One File
The above setup will serve a whole directory, just like TheCampingServer. If you only want to serve one app (at the root) change the last line in dispatch.rb to point to a single file.
#!ruby
Camping::FastCGI.serve("/usr/local/data/examples/blog.rb")
Mounting at a Subdirectory
You can certainly use ScriptAlias to attach the Camping app to a subdirectory, rather than root. If you are using URL() and R() in your code, the paths will change accordingly.
ScriptAlias /myapp /usr/local/www/data/dispatch.rb/
