#get some necessary packages before beginning #some are used to build ruby, some are required for gems that will be installed/built later sudo wajig install build-essential libssl-dev ssl-cert libssl0.9.8 openssl slapd ldap-utils libldap2 libmagick9 libmagick9-dev ibldap2-dev memcached zlib1g zlib1g-dev #dowload apache2.2 source and extract #in apache2.2 source dir #apache 2.2 configure ./configure --prefix=/etc/apache2 --enable-cache --enable-mem-cache --enable-deflate --enable-proxy --enable-proxy-html --enable-proxy-balancer --enable-rewrite make sudo make install #download Ruby source #edit ext/Setup to look like: #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #begin ext/Setup #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ option nodynamic #Win32API bigdecimal curses dbm digest digest/md5 digest/rmd160 digest/sha1 digest/sha2 #dl etc enumerator fcntl #gdbm iconv #io/wait nkf #pty openssl racc/cparse readline #sdbm socket stringio strscan syck syslog #tcltklib #tk #win32ole zlib #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #end ext/Setup #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #in ruby source dir ./configure make sudo make install #dowload ruby gems source, tar -xvzf ruby-source #in ruby source dir ruby setup.rb #if you receive permission error on creating directories, manually create them gem install rails --include-dependencies gem install daemons gem_plugin mongrel mongrel_cluster sendfile --include-dependencies gem install rmagick postgres-pr memcache-client vim-ruby pdf_writer --include-dependencies #In your rails app dir #create the config/mongrel_cluster.yml #-e : environment (production, development (default)) #-p : port #-a : address (using localhost) #-N : number of clients #-c : work dir (should be RAILS_ROOT dir of application) mongrel_rails cluster::configure -e development -p 8000 -a 127.0.0.1 -N 2 -c /var/www/ #configure mongrel cluster as system service cd /etc/init.d sudo ln -s /usr/local/lib/ruby/gems/1.8/gems/mongrel_cluster-0.2.0/resources/mongrel_cluster mongrel_cluster sudo chmod +x mongrel_cluster sudo /usr/sbin/update-rc.d mongrel_cluster defaults #fyi: to remove #sudo /usr/sbin/update-rc.d mongrel_cluster remove cd /etc sudo mkdir mongrel_cluster sudo ln -s /var/www//config/mongrel_cluster.yml .yml #apache configuration sudo cp httpd.conf httpd.conf.orig sudo vi httpd.conf #change DocumentRoot defining htdocs #DocumentRoot "/var/www" #change Directory defining htdocs #Directory "/var/www"> #create a common configuration that applies to all apps sudo vi /etc/apache2/conf/common.conf #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #begin common.conf #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ UseCanonicalName Off ServerSignature On Options FollowSymLinks Allow from all #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #end common.conf #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #vhost definition cd /etc/apache2/conf/extra sudo cp httpd-vhosts.conf httpd-vhosts.conf.orig sudo vi httpd-vhost.conf #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #begin httpd-vhosts.conf #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NameVirtualHost *:80 ServerAdmin andrew.n.stone@gmail.com ServerName .com DocumentRoot /var/www//public ErrorLog /var/log/apache2/_error_log CustomLog /var/log/apache2/_access_log combined /public> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all ProxyPass /images ! ProxyPass /stylesheets ! ProxyPass /javascripts ! ProxyPass /favicon.ico ! ProxyPass / balancer://_cluster ProxyPreserveHost On _cluster> BalancerMember http://127.0.0.1:8000 BalancerMember http://127.0.0.1:8001 RewriteEngine On # Uncomment for rewrite debugging #RewriteLog /var/log/apache2/_rewrite_log #RewriteLogLevel 9 # Rewrite index to check for static RewriteRule ^/$ /index.html [QSA] # Rewrite to check for Rails cached page RewriteRule ^([^.]+)$ $1.html [QSA] # Redirect all non-static requests to cluster RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://_cluster%{REQUEST_URI} [P,QSA,L] # Deflate AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4.0[678] no-gzip BrowserMatch bMSIE !no-gzip !gzip-only-text/html # Uncomment for deflate debugging #DeflateFilterNote Input input_info #DeflateFilterNote Output output_info #DeflateFilterNote Ratio ratio_info #LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate #CustomLog /var/log/apache2/_deflate_log deflate #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #end httpd-vhosts.conf #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cd /etc/apache2/conf sudo vi httpd.conf #first line under Supplemental configuration #include your common.conf Includ conf/common.conf #enable vhosts in /etc/apache2/conf/httpd.conf #uncomment the following Include conf/extra/httpd-vhosts.conf #start/stop by using sudo /etc/apache2/bin/apachectl (start|stop)