# Installing Rails on FreeBSD with Apache (and php)

**URL:** <https://www.ruby-forum.com/t/installing-rails-on-freebsd-with-apache-and-php/53544>\
**Category:** Rails\
**Created:** [February 9, 2006, 12:27am UTC](https://www.ruby-forum.com/t/installing-rails-on-freebsd-with-apache-and-php/53544 "2006-02-09T00:27:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chidori](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/edb3f5/32.png) [@chidori](https://www.ruby-forum.com/u/chidori)\
**Post date:** [February 9, 2006, 12:27am UTC](https://www.ruby-forum.com/t/installing-rails-on-freebsd-with-apache-and-php/53544/1 "2006-02-09T00:27:51Z")

</div>

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… 😉

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

---

<div class="post-metadata">

**Author:** ![chidori](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/edb3f5/32.png) [@chidori](https://www.ruby-forum.com/u/chidori)\
**Post date:** [February 9, 2006, 12:46am UTC](https://www.ruby-forum.com/t/installing-rails-on-freebsd-with-apache-and-php/53544/2 "2006-02-09T00:46:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![chidori](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/edb3f5/32.png) [@chidori](https://www.ruby-forum.com/u/chidori)\
**Post date:** [February 9, 2006, 12:54am UTC](https://www.ruby-forum.com/t/installing-rails-on-freebsd-with-apache-and-php/53544/3 "2006-02-09T00:54:06Z")

</div>

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.
