Ruby 1.9 + Rails + Nginx + Passenger with SSL

Prerequisites

For maximum compatibility, you should have the following libraries installed before installing Ruby -- these correspond to Debian (lenny) so YMMV:

sudo apt-get install zlib1g-dev
sudo apt-get install libreadline5-dev
sudo apt-get install libssl-dev

Ruby 1.9

cd /usr/local/src
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p129.tar.gz
tar -zxvf ruby-1.9.1-p129.tar.gz && cd ruby-1.9.1-p129
./configure && make
sudo make install

NOTE: I ignored my initial advice and forgot to install readline, zlib and OpenSSL so I had to do the following as well:

cd ext/readline
ruby extconf.rb && make
sudo make install

cd ext/zlib
ruby extconf.rb && make
sudo make install

cd ext/openssl
ruby extconf.rb && make
sudo make install

Rubygems 1.3.5

cd /usr/local/src
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar -zxvf rubygems-1.3.5.tgz && cd rubygems-1.3.5
sudo ruby setup.rb

Rails 2.3.3

sudo gem install rails

Nginx + Passenger (w/ SSL)

cd /usr/local/src
wget http://sysoev.ru/nginx/nginx-0.7.61.tar.gz
tar -zxvf nginx-0.7.61.tar.gz && cd nginx-0.7.61

sudo gem install passenger
sudo passenger-install-nginx-module

You will be prompted whether to let Passenger download and install Nginx for you. Ensure that you select the second option and specify the path to the Nginx source that you just unzipped:

2 No: I want to customize my Nginx installation. (for advanced users)

Please specify the directory: /usr/local/src/nginx-0.7.61

Please specify a prefix directory [/opt/nginx]: /usr/local/nginx

Extra arguments to pass to configure script: --with-http_ssl_module

I'll leave you here. You should be able to edit your Nginx config as appropriate and fire it up!

References

http://erbmicha.com/2009/04/21/phusion-passenger-nginx-ssl/

blog comments powered by Disqus