Created
September 6, 2012 09:05
-
-
Save navasvarela/3653401 to your computer and use it in GitHub Desktop.
Sinatra setup in bluehost
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AddHandler fcgid-script .fcgi | |
AddHandler cgi-script .cgi | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/home2/salatecs/.rvm/rubies/ruby-1.9.3-p194/bin/ruby | |
require 'rubygems' | |
fastcgi_log = File.open("fastcgi.log", "a") | |
STDOUT.reopen fastcgi_log | |
STDERR.reopen fastcgi_log | |
STDOUT.sync = true | |
print %x[which ruby] | |
# You must put the gems on the path | |
ENV["GEM_HOME"] = "/home2/salatecs/.rvm/gems/ruby-1.9.3-p194@global" | |
# sinatra should load now | |
require 'sinatra' | |
module Rack | |
class Request | |
def path_info | |
@env["REDIRECT_URL"].to_s | |
end | |
def path_info=(s) | |
@env["REDIRECT_URL"] = s.to_s | |
end | |
end | |
end | |
require_relative 'app' | |
builder = Rack::Builder.new do | |
use Rack::ShowStatus | |
use Rack::ShowExceptions | |
run Sinatra::Application | |
end | |
Rack::Handler::FastCGI.run(builder) |
Also make sure that you are using sinatra classic, instead of modular. Modular doesn't play well with FastCGI.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To Install fcgi:
wget http://www.fastcgi.com/dist/old/fcgi-2.2.2.tar.gz
tar -zxvf fcgi-2.2.2.tar.gz
cd fcgi-2.2.2
mkdir $HOME/src
./configure --prefix=$HOME/src/fcgi
make && make install
gem install fcgi -r -- --with-fcgi-include=$HOME/src/fcgi/include --
with-fcgi-lib=$HOME/src/fcgi/lib