Here are some of the ways to run Ruby on Rails behind Apache.
Reference Howto Setup Apache With FastCGI And Ruby Bindings.
Make sure mod_fcgid is available, if not, install it
# emerge -pv www-apache/mod_fcgid
I was not able to install it via gem. See error below:
# gem18 install fcgi
Building native extensions. This could take a while...
ERROR: Error installing fcgi:
ERROR: Failed to build gem native extension.
/usr/bin/ruby18 extconf.rb install fcgi
checking for fcgiapp.h... no
checking for fastcgi/fcgiapp.h... no
*** extconf.rb failed ***
It turned out that I didn't have fcgi lib installed. Actually, using emerge could satisfy the boken dependency
# emerge -pv emerge -pv dev-ruby/ruby-fcgi
Another option is to download Ruby fcgi from http://raa.ruby-lang.org/project/fcgi/ and install from source:
# tar xzf ruby-fcgi-0.8.7.tar.gz
# cd ruby-fcgi-0.8.7
# ruby install.rb config
# ruby install.rb setup
# ruby install.rb install
With this option, you also need the fcgi lib.
There isn't anything we need to do with apache configuration, other than adding "-D FCGID" into APACHE2_OPTS variable in the file /etc/conf.d/apache. The restart apache.
In your project/public/.htaccess file, however, you need to:
Here are some greate reference on how to set it up:
This is another option to check out. I think it is fairly new. http://modrails.com/. In portage, it is called "www-apache/passenger". "emerge -pv www-apache/passenger" will give you the info.
Comments
Anonymous
January 15, 2009
3 years 3 weeks
Hardware
"A wonderful article you posted. That is so informatory and creative. Please keep these excellent posts coming. You helped me so much.
Thanks for sharing!"