Install and run Ruby On Rails Application on localhost

USE standalone Ruby Server installations: a) http://railsinstaller.org/en b) http://www.helicontech.com/zoo/install.html c) https://bitnami.com/stack/ruby

OR

1) Install WAMP (or etc)
2) Install Ruby
3) open …wamp\bin\apache\apacheXXXX\conf\httpd.conf, then search & replace
Options Indexes FollowSymLinks
with
Options Indexes FollowSymLinks ExecCGI (or Options Indexes FollowSymLinks Includes ExecCGI)
p.s. also, Find & ensure that LoadModule cgi_module is NOT commented.

4) search & replace
#AddHandler cgi-script .cgi
with (…removing # )
AddHandler cgi-script .cgi
AddHandler cgi-script .rb

5) Find the line: DirectoryIndex index.php index.php3 index.html index.htm
and add in the end of them: index.cgi index.rb
Now, Restart Apache.

6) create a sample.rb (in /www root), with such content:

#!C:\Ruby200\bin\ruby\ruby.exe
puts "Content-type: text/html" #in newer version, might be puts("....")
puts ""
puts "Test Pageeeeeeeee."

p.s. NOTE: (a) Change C:|Ruby.. path to your RUBY installation path correctly. (b) To avoid problems, dont install RUBY in a path, wherein any “folder name” contains a space. (c) There should not be a space between the start of line and print(..

7) open http://localhost/sample.rb

THAT’s all!!

p.s.note, in come cases, while using .htaccess [inside .rb directory], you might need to insert these lines in .htaccess:
Options +ExecCGI
AddHandler cgi-script .rb

Comments

comments

Leave a Reply