Skip to content

Instantly share code, notes, and snippets.

@semikolon
Forked from mislav/install-passenger.sh
Created February 7, 2009 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save semikolon/59888 to your computer and use it in GitHub Desktop.
Save semikolon/59888 to your computer and use it in GitHub Desktop.
RE="ruby-enterprise-1.8.6-20081215"
PREFIX=/opt/$RE
VERSION=2.0.6
GEM_PATH="$PREFIX/lib/ruby/gems/1.8/gems/passenger-$VERSION"
DOMAIN=odpiralnicasi.com
APP_ROOT=/srv/oc
# install Apache2
apt-get install -qq apache2 apache2-prefork-dev
# download and install REE
cd /tmp
wget http://rubyforge.org/frs/download.php/48623/$RE.tar.gz -O- | tar xz
$RE/installer -a $PREFIX | ruby -e 'while gets; print "."; $stdout.flush; end'
# install necessary gems (Rails is auto-installed)
cd $PREFIX/bin
./gem install mojombo-grit mislav-will_paginate mattetti-googlecharts ryanb-acts-as-list haml thoughtbot-paperclip raspell bj
# install Passenger -- this step is INTERACTIVE
./passenger-install-apache2-module
# set up Apache to load the new module
echo "LoadModule passenger_module $GEM_PATH/ext/apache2/mod_passenger.so" > /etc/apache2/mods-available/passenger.load
ln -s ../mods-available/passenger.load /etc/apache2/mods-enabled/passenger.load
echo "PassengerRoot $GEM_PATH
PassengerRuby $PREFIX/bin/ruby" > /etc/apache2/mods-available/passenger.conf
ln -s ../mods-available/passenger.conf /etc/apache2/mods-enabled/passenger.conf
# mod_deflate
echo "<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml
</IfModule>" > /etc/apache2/mods-available/deflate.conf
ln -s ../mods-available/deflate.load /etc/apache2/mods-enabled/deflate.load
ln -s ../mods-available/deflate.conf /etc/apache2/mods-enabled/deflate.conf
# mod_rewrite
ln -s ../mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
# set up a virtual host
echo "<VirtualHost *:80>
ServerName www.$DOMAIN
ServerAlias $DOMAIN *.$DOMAIN
DocumentRoot $APP_ROOT/current/public
RailsEnv production
RailsAllowModRewrite on
<LocationMatch "\.(js|css)$">
SetOutputFilter DEFLATE
</LocationMatch>
</VirtualHost>" > /etc/apache2/sites-available/$DOMAIN
# link it up
rm -f /etc/apache2/sites-enabled/*
ln -s ../sites-available/$DOMAIN /etc/apache2/sites-enabled/$DOMAIN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment