Camping On Site5
If you use Site5 for your hosting, you can host individual Camping apps in subdirectories, which can be the directories created when you add a subdomain.
For example, if you would like to host the Camping app app.rb on http://app.domain.com, you could use the following .htaccess:
AddHandler fastcgi-script .fcgi
Options +FollowSymLinks +ExecCGI
RewriteEngine On
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
Your dispatch.fcgi will need to include the GEM_PATH and GEM_HOME of any custom gems you have installed.
#!/usr/bin/ruby
ENV['GEM_PATH'] = "/home/your/custom/gems:/usr/lib/ruby/gems/1.8"
ENV['GEM_HOME'] = "/home/your/custom/gems"
ENV['FORCE_ROOT'] = 1.to_s
require 'rubygems'
require 'camping/fastcgi'
Camping::Models::Base.establish_connection :adapter => 'sqlite3', :database => 'app.db'
Camping::FastCGI.serve('/home/your/public_html/app/app.rb')
However, we're not done yet. Things in Camping itself have to be tweaked to accomodate Site5. camping/fastcgi.rb:133 reads:
path = req.env['SCRIPT_NAME']
Change this to
path = req.env['REQUEST_URI']
I was able to do this, and use no PostAmble, and have a working application. This is clearly a bit of a hack, but until this is straightened out, it works like a charm. Be wary of updates to Camping.
