Side-by-side Apache 2.2 and Ruby on Rails on RHEL3/4

Download the latest Apache 2.2 sources from http://httpd.apache.org/download.cgi

Untar the sources, and configure and install:

./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate \
--enable-proxy --enable-proxy-balancer --enable-proxy-http --enable-rewrite
make
make install

This will install to /usr/local/apache2, and include common modules, as well as mod_deflate, mod_rewrite, and everything you need to set up a mod_proxy_balancer mongrel cluster. Note that this will compile with prefork MPM (the default). If you want to use worker MPM, just add --with-mpm=worker to the configuration flags. IMPORTANT: Per php.net, you should NOT use worker MPM if you intend to server php content via mod_php http://us.php.net/manual/en/faq.installation.php#faq.installation.apache2.
If you need PHP support, you need to either use prefork MPM or fast cgi.

Copy the attached 'apache' file to /etc/init.d and make it executable (chmod +x /etc/init.d/apache). This is a modified init script that will allow you to control the installation via service and chkconfig without interfering with the existing apache install. You can now proceed to set up /usr/local/apache2/conf/httpd.conf as needed. Documentation on configuring Apache to work with mongrel_cluster may be found at http://mongrel.rubyforge.org/docs/apache.html
Note that you'll need to edit the Listen directive appropriately. You'll need a separate IP or IPs for this additional instance of Apache.

As the packaged version of Ruby that comes with RHEL is rather old, you probably want to build a newer version. Get the Ruby source, and the installer for RubyGems, from http://rubyonrails.org/down
You can install ruby with the standard:
tar -zxvf rubyfilename.tar.gz
cd rubydirectoryname
./configure && make && make install
By default, it will install the executable to /usr/local/bin/ruby, and it will take precedence over the default RHEL install.

For RubyGems, just cd into the directory you untarred it into and run 'ruby setup.rb'.

You can then install rails with 'gem install rails --include-dependencies', mongrel with 'gem install mongrel' and mongrel_cluster with 'gem install mongrel_cluster'. You will be presented with some options during the installation... just select the newest version appropriate to your architecture unless you have reason to do otherwise. See http://mongrel.rubyforge.org/ for more information on Mongrel configuration.

AttachmentSize
apache3.13 KB
Submitted by jkelly on Wed, 2007-07-11 18:53. categories [ | | ] login or register to post comments