Installing Rails on FreeBSD with Apache (and php)


#1

Hi,

Sometime in the near future I’m going to attempt an installation of
Rails on one of our school servers, so that a few of our most talanted
students also will have the opportunity to learn RoR. The problem is
that I’m not entirely sure on the best way to proceed, and I’m the only
teacher on the school with Rails experience, but only for Windows.

The server runs on FreeBSD and uses Apache, and has php and mysql
installed. The most important function of the server is for database
handling and a bit of webdesign, in which classes the students use php
and mysql as primary tools. This means that it’s vital that php
function is still fully enabled for the entire server. It indicates that
I don’t want to ‘override’ the current setup with Rails, but rather
complement the server with RoR. I want a few selected students to be
able to add Rails applications to their home directories on the server
and use links in their public_html folders to call the apps, but still
be able to work as normal with php.

So far, I haven’t been able to find any tutorials on how to do what I
want - most setups seems to make RoR a primary application on the
server, and so forth, using port 80 for a single RoR application
(correct me if I’m wrong). I know it’s possible, though, since
practically every webhost with RoR use it this way.

I would appreciate links to guides or detailed instructions on how to
set up the Apache server. I think I’ll be able to handle the
installation of Ruby and later Rails pretty easily, since that seems
rather straight-forward. I’m not sure about FCGI, though, but imagine
that at least one of my colleagues might. However, as I’ve said, I’m the
only person with RoR experience, so… :wink:

If there really is no other way, I could consider adding Rails to
another port of the server, but that’s not really an ideal solution.

Thanks in advance,

Sebastian


#2

On Thu, 2006-02-09 at 00:27 +0100, Sebastian Conrad wrote:

handling and a bit of webdesign, in which classes the students use php
server, and so forth, using port 80 for a single RoR application
If there really is no other way, I could consider adding Rails to
another port of the server, but that’s not really an ideal solution.


They can at least get started using webrick controller for RonR stuff
and you can give them each their own port assignment to minimize
chaos…and yet still continue to use apache/php normally…they can
create their own redirects to their port #/controllers, etc. within
their base apache pages.

I figured this one out today…

script/server -p 8000 # starts webrick on port 8000

Craig


#3

Sebastian Conrad wrote:

handling and a bit of webdesign, in which classes the students use php
server, and so forth, using port 80 for a single RoR application
(correct me if I’m wrong). I know it’s possible, though, since
practically every webhost with RoR use it this way.

you can install mod_fcgid and use it for both php and rails apps (or
just rails). here is how i do it:

AddHandler fcgid-script .php .fcgi
<Directory “/home/www/*”>
…other direcives…
FCGIWrapper /usr/local/bin/php .php

to use php under mod_fcgid, you have to compile it with fastcgi support,
but that’s all. if you want to use the standard mod_php way, remove the
FCGIWrapper directive and take .php out of AddHandler.

in your case, you would probably use the standard

<Directory “/home//public_html/”>

which is already in the apache config.