i TRY TO CONFIGURE APACHE FOR RUBY ON RAILS ON UNIX.
BY THE FOLLOWING WAYl:
Install FastCGI
1. wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
2. gunzip fcgi-2.4.0.tar.gz
3. tar -xvf fcgi-2.4.0.tar
4. cd fcgi-2.4.0
5. ./configure
6. make
7. make install
8. cd ../
Install mod_fcgid
1. cd ~
2. wget http://fastcgi.coremail.cn/mod_fcgid.1.09.tar.gz
3. gunzip mod_fcgid.1.09.tar.gz
4. tar -xvf mod_fcgid.1.09.tar
5. cd mod_fcgid.1.09
6. vi Makefile
Change top_dir to:
top_dir = /usr/lib/httpd
Uncomment #INCLUDES and change to
INCLUDES=-I /usr/include/httpd -I /usr/include/apr-0
7. make
8. make install
9. cd ../
Install Ruby
1. cd /etc/yum.repos.d/
2. wget http://dev.centos.org/centos/4/CentOS-Testing.repo
3. yum --enablerepo=c4-testing install ruby ruby-docs ri ruby-libs
ruby-mode ruby-tcltk irb rdoc ruby-devel
Install Ruby Gems
1. wget
http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
2. tar -xzf rubygems-0.9.0.tgz
3. cd rubygems-0.9.0
4. ruby setup.rb
5. cd ../
Install Rails, FastCGI, and Mysql
1. gem install rails --include-dependencies
2. gem install fcgi
3. gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
1. Select option 1 – mysql 2.7.1 (ruby)
4. vi /etc/ld.so.conf
Add line:
/usr/local/lib
5. /sbin/ldconfig
Create Test Application – this will get you started on the popular
“cookbook” tutorial from OnLamp.
1. mkdir /var/www/rails
2. cd /var/www/rails/
3. rails cookbook
Set Permissions on Test Application
1. chgrp -R apache cookbook/
2. chmod -R g+r cookbook/
3. chmod -R g+w cookbook/log/
4. chmod -R g+w cookbook/tmp/
5. find /var/www/rails/cookbook/ -type d -exec chmod g+x {} \;
Configure Apache
1. vi /etc/httpd/conf.d/fcgid.conf
Insert the following:
LoadModule fcgid_module /usr/lib/httpd/modules/mod_fcgid.so
<IfModule mod_fcgid.c>
SocketPath /tmp/fcgid_sock/
AddHandler fcgid-script .fcgi
</IfModule>
1. vi /etc/httpd/conf.d/hosts.conf
(Personally, I put all my custom Apache configuration in this file
to keep things organized)
Insert the following:
<VirtualHost *:80>
SetEnv RAILS_ENV development
ServerName dnsnameoripaddress
DocumentRoot /var/www/rails/cookbook/public/
ErrorLog /var/www/rails/cookbook/log/apache.log
<Directory /var/www/rails/cookbook/public/>
Options ExecCGI FollowSymLinks
AddHandler fcgid-script .fcgi
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
2. vi /var/www/rails/cookbook/public/.htaccess
Change line:
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
to
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
And change:
AddHandler fastcgi-script .fcgi
to
AddHandler fcgid-script .fcgi
do NOT change the require line as other guides tell you to do.
Hello, World!
1. cd /var/www/rails/cookbook/
2. ruby script/generate controller mytest
3. vi app/controllers/my_test_controller.rb
Change file to read:
class MyTestController < ApplicationController
def index
render_text => "Hello World!"
end
end
4. /sbin/service httpd start
BUT AT LAST IS ACTION CONTROLLER EXCEPTION AND PAGE IS REDIRECTED OTHER
SITES.
THIS CONFIGURATION DO NOT .
IS CONFIGURING APACHE FOR RUBY ON RAILS IS POSSIBLE OR NOT
IFF POSSIBLE PLEASE FORWARD ME THE APPROPIATE LINKS FOR WINDOW AND UNIX
PLATEFORM
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---