F_A_H_D

Active Member
Sep 17, 2006
25
0
151
guys
i walked on howtoinstallrubyonrails review
i just want to try ruby
i made anew user account on shared server & i give it shell access
i tested this from shell
ruby -e 'print "hello world\n"'
hello world
so it works nice from shell
how i can test it from browser ????????
is ruby file must take special extension ???
is there any reconfiguration to httpd.conf server wide ???
plz i need help
 

Kasper

Active Member
Aug 26, 2004
28
0
151
Chicago
Probably this helps:
Install Ruby:

cd /usr/local/src/ruby
wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.4.tar.gz
tar -xzf ruby-1.8.4.tar.gz
cd ruby-1.8.4/
./configure && make && make install

Next Ruby Gems:

cd /usr/local/src/ruby
wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
tar -xzf rubygems-0.8.11.tgz
cd rubygems-0.8.11/
ruby setup.rb

Once Gems are installed, install Rails:
gem install rails

Install FastCGI:
cd /usr/local/src/ruby
wget fastcgi.com/dist/fcgi-2.4.0.tar.gz
tar -xzf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure && make && make install

And mod_fastcgi for Apache 1.3+
cd /usr/local/src/ruby
wget fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz
tar -xzf mod_fastcgi-2.4.2.tar.gz
cd mod_fastcgi-2.4.2
/usr/local/apache/bin/apxs -o mod_fastcgi.so -c *.c
/usr/local/apache/bin/apxs -i -a -n fastcgi mod_fastcgi.so

Now for Ruby fcgi:
gem install fcgi

You now need to edit your Apache config file.
LoadModule fastcgi_module libexec/mod_fastcgi.so

<IfModule mod_fastcgi.c>
FastCgiIpcDir /tmp/fcgi_ipc/
AddHandler fastcgi-script .fcgi
</IfModule>

mkdir /tmp/fcgi_ipc/
mkdir /tmp/fcgi_ipc/dynamic

$ chown nobody.nobody /tmp/fcgi_ipc/ -R
$ chmod 755 /tmp/fcgi_ipc/ -R


$ cd /home/USER
$ rails /home/USER/testapp
$ cd /home/USER/testapp/
$ ruby script/generate controller test
$ cd /home/USER/public_html
$ ln -s ../testapp/public rails



#!/usr/local/bin/ruby
require 'cgi'
require 'rubygems'
require_gem 'fcgi'

FCGI.each_cgi do |cgi|
content = ''
env = []
cgi.env_table.each do |k,v|
env << [k,v]
end
env.sort!
env.each do |k,v|
content << %Q(#{k} => #{v}<br>\n)
end
cgi.out{content}
end


gem update mysql