Debian Sarge (3.1) with Ruby on Rails and Apache 2 with FastCGI - Page 4
Install Apache and Ruby
apt-get install apache2 apache2-doc
apt-get install libapache2-mod-php4 libapache2-mod-perl2 php4 php4-cli php4-common php4-curl php4-dev php4-domxml php4-gd php4-imap php4-ldap php4-mcal php4-mhash php4-mysql php4-odbc php4-pear php4-xslt curl libwww-perl imagemagick
apt-get install ruby ruby1.8-dev rdoc apache2-prefork-dev make
Edit /etc/apache2/apache2.conf.
joe /etc/apache2/apache2.conf
change:
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml |
to
DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml |
Edit /etc/mime.types and comment out the following lines:
joe /etc/mime.types
#application/x-httpd-php phtml pht php |
Edit /etc/apache2/mods-enabled/php4.conf and comment out the following lines:
joe /etc/apache2/mods-enabled/php4.conf
<IfModule mod_php4.c> |
Edit /etc/apache2/ports.conf and add Listen 443:
joe /etc/apache2/ports.conf
Listen 80 |
Now we have to enable some Apache modules (SSL, rewrite and suexec):
a2enmod ssl
a2enmod rewrite
a2enmod suexec
Install the FastCGI library
*Note 2.4.0 is the current version if it is not available visit www.fastcgi.com to get the latest.
cd /usr/local/src
wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
tar xvzf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure && make && make install
Installation of mod_fastcgi.so for Apache2
Download the mod_fastcgi sources from http://www.fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz. If the Link is not working, try to get the latest mod_fastcgi sources instead. Make the mod_fastcgi module.
cd /usr/local/src
wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz
tar xvzf mod_fastcgi-2.4.2.tar.gz
cd mod_fastcgi-2.4.2
cp Makefile.AP2 Makefile
make top_dir=/usr/share/apache2
make install top_dir=/usr/share/apache2
Enable mod_fastcgi in Apache2
echo 'LoadModule fastcgi_module /usr/lib/apache2/modules/mod_fastcgi.so' > /etc/apache2/mods-available/fastcgi.load
a2enmod fastcgi
Installation of ruby-fcgi bindings, Ruby GEM and Rails:
Download the ruby-fcgi bindings from http://sugi.nemui.org/pub/ruby/fcgi/ruby-fcgi-0.8.6.tar.gz. If the Link is not working, try to get the latest ruby-fcgi bindings instead.
cd /usr/local/src
wget http://sugi.nemui.org/pub/ruby/fcgi/ruby-fcgi-0.8.6.tar.gz
tar xvzf ruby-fcgi-0.8.6.tar.gz
cd ruby-fcgi-0.8.6
ruby install.rb config
ruby install.rb setup
ruby install.rb install
cd /usr/local/src
wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
tar zxvf rubygems-0.8.11.tgz
cd rubygems-0.8.11
ruby1.8 setup.rb
gem install rubygems-update
gem install rails --include-dependencies
gem install mysql
Answer 2 mysql 2.7(ruby)
Restart Apache:
/etc/init.d/apache2 restart