# Rails on a "/cgi-bin" and ".rb" focused web server

**URL:** <https://www.ruby-forum.com/t/rails-on-a-cgi-bin-and-rb-focused-web-server/81930>\
**Category:** Rails\
**Created:** [January 16, 2007, 11:30am UTC](https://www.ruby-forum.com/t/rails-on-a-cgi-bin-and-rb-focused-web-server/81930 "2007-01-16T11:30:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Madoc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@Madoc](https://www.ruby-forum.com/u/Madoc)\
**Post date:** [January 16, 2007, 11:30am UTC](https://www.ruby-forum.com/t/rails-on-a-cgi-bin-and-rb-focused-web-server/81930/1 "2007-01-16T11:30:49Z")

</div>

Hello dear Rubyists,

I would like to program my homepage with Ruby on Rails. However, on my  
homepage web server, there seem to be some restrictions:

- Scripts are only executed when they reside inside the “/cgi-bin”  
directory.
- Ruby scripts must end with “.rb”; the extension “.rhtml” is not  
recognized.
- I am not sure if the Rails libraries are installed. Ruby itself seems  
to work though.

So, here come my questions. (First of all, I assume that I develop my  
homepage as a normal Rails application, just like all the Ruby  
beginner’s guides tell me to.)

1. When my homepage is a regular Rails application, this would require  
that I can call something like “[myserver.com/appname/action](http://myserver.com/appname/action)” or  
something - a special URL format. Is there any way that I can “map”  
this to something like:  
“[myserver.com/cgi-bin/script.rb?appname=foo&action=bar](http://myserver.com/cgi-bin/script.rb?appname=foo&action=bar)” or so? I mean,  
can I make a regular Rails application work, based on the “/cgi-bin”  
script restriction? (I hope this was understandable.)

2. How do I find out if the Rails libraries are installed? (I don’t  
have telnet or ssh access; I can just execute “.rb” scripts per HTTP,  
which I uploaded using FTP.)

3. If the Rails libraries are not installed, is there a simple way for  
me to upload them and use them in my Ruby scripts?

4. If all of that will not work out, what would be an easy, small  
change which I could request from my hoster, to make this work,  
whithout requiring them to change their whole webserver?

Thanks for Your attention. I am quite new to Ruby, so please don’t  
expect from me to understand any elaborated concepts. But I’m also  
really keen on using RoR for my homepage, so I really hope I get this  
working.

Thanks,  
Madoc.

---

<div class="post-metadata">

**Author:** ![Madoc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@Madoc](https://www.ruby-forum.com/u/Madoc)\
**Post date:** [January 16, 2007, 12:00pm UTC](https://www.ruby-forum.com/t/rails-on-a-cgi-bin-and-rb-focused-web-server/81930/2 "2007-01-16T12:00:53Z")

</div>

I have one more remark:

PHP scripts also get executed when they are somewhere else than in  
“cgi-bin”.  
So one of my ideas is to make a PHP script that only contains something  
like  
this (in pseudo-syntax):

 \<?php php\_command\_to\_make\_an\_internal\_redirect\_to\_ruby(); ?\>

Maybe this would be a solution. However, the URI would need to be  
changed.  
Might be that the original URL is something like:

[http://myserver.com/index.php?/ruby/argument/uri](http://myserver.com/index.php?/ruby/argument/uri)

The internal redirect should go to:

[http://myserver.com/cgi-bin/somerubyscript.rb?](http://myserver.com/cgi-bin/somerubyscript.rb?)…

I’m completely lost on this.

Madoc schrieb:

---

<div class="post-metadata">

**Author:** ![Madoc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@Madoc](https://www.ruby-forum.com/u/Madoc)\
**Post date:** [January 16, 2007, 1:03pm UTC](https://www.ruby-forum.com/t/rails-on-a-cgi-bin-and-rb-focused-web-server/81930/3 "2007-01-16T13:03:06Z")

</div>

One more remark: I discovered that the Rails gem is installed, with  
version 1.1.2.

Also, for Ruby scripts in “/cgi-bin” to work, they must have  
“#!/bin/ruby -” as their first line.

---

<div class="post-metadata">

**Author:** ![Madoc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@Madoc](https://www.ruby-forum.com/u/Madoc)\
**Post date:** [January 16, 2007, 2:35pm UTC](https://www.ruby-forum.com/t/rails-on-a-cgi-bin-and-rb-focused-web-server/81930/4 "2007-01-16T14:35:37Z")

</div>

I’ve been testing RoR for quite a while, and I can tell you one thing  
for sure – you’re wasting your time, trying to learn a workaround for  
installation. Do not try to invent a new path. Your hair will go grey  
and you’ll start to despise life itself.

Even if you try to follow the advice provided in the webpages and  
books, you’ll have troubles. Setting up RoR for websites is a very  
painful thing. Part of the problem is that there is no one method that  
is preferred above others. It is a changing field. The best  
documentation (I’m told) is the “Agile” book, referred to on the main  
RoR webpage. Well, I just bought the new edition, and it is very,  
very, nice. I recommend it highly. However, there is a very scary bit  
to the book. When it comes to deploying the site (as opposed to  
playing around with a test server), things get nasty. The authors note  
that the previous edition of the book recommended a particular method,  
but that they now (just a year later) strongly recommend AGAINST that  
method, and have a new shiny method that they favour. Neither method  
is easy to set up, EVEN IF you have administrator priviledges.

I realise, from the tone of your post, that most of what I say is  
irrelevant. You need to hear one message, and only one, at this time:  
do NOT waste time trying to find a new path. Try the tutorial. If it  
works, continue on with RoR programming. If not, give up and go back  
to PHP, which is almost certain to work on most platforms.

PS. I’m at the “give up” stage, actually. If we measure the effort in  
learning RoR as X, then the effort in learning to deploy a rails  
website (not using the test server) is of order X. That is too much  
pain for something so boring, and requiring so many admin priviledges  
that (a) you can screw up your machine or (b) a reasonable sysadmin  
will tell you to get lost.

PPS. Of course, you could go commercial. Pay someone to set up the RoR  
stuff for you, on a Rails-compatible site. But of course you may not  
want to start shelling out money for that until you learn whether RoR  
is for you.

PPPS. All of this applies to Django, also.

---

<div class="post-metadata">

**Author:** ![Madoc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@Madoc](https://www.ruby-forum.com/u/Madoc)\
**Post date:** [January 16, 2007, 6:22pm UTC](https://www.ruby-forum.com/t/rails-on-a-cgi-bin-and-rb-focused-web-server/81930/5 "2007-01-16T18:22:49Z")

</div>

On 1/16/07, Madoc [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> So, here come my questions. (First of all, I assume that I develop my
> 
> 1. How do I find out if the Rails libraries are installed? (I don’t  
> have telnet or ssh access; I can just execute “.rb” scripts per HTTP,  
> which I uploaded using FTP.)

I wouldn’t use Rails on a host that didn’t offer shell access. I’d  
definately request this, and if they refuse, I’d look for a different  
host.

> 1. If the Rails libraries are not installed, is there a simple way for  
> me to upload them and use them in my Ruby scripts?
> 
> 2. If all of that will not work out, what would be an easy, small  
> change which I could request from my hoster, to make this work,  
> whithout requiring them to change their whole webserver?

I have one site that I host where I couldn’t change the webserver  
configuration, and the webserver didn’t support proxing or fastcgi. I  
ended up using cgi2scgi and setting up Rails with SCGI Rails Runner.  
I remember having to change some Rails internals to get it to work,  
but it does work, and it works well enough for a small site.

You are probably better off using a host that better supports Rails,  
so I’d look into other hosts if at all possible.

---

<div class="post-metadata">

**Author:** ![Madoc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@Madoc](https://www.ruby-forum.com/u/Madoc)\
**Post date:** [January 16, 2007, 11:44pm UTC](https://www.ruby-forum.com/t/rails-on-a-cgi-bin-and-rb-focused-web-server/81930/6 "2007-01-16T23:44:10Z")

</div>

Toby, thanks for that encouragement. I’ll stick with it for a while  
longer.

PS. Railsmachine charges $75 per month for hosting. I’m just a  
professor trying to set up good websites for my classes, using local  
machines. I have no budget for hosting services. Actually, I suspect  
most professors and students are in the same category: we can do PHP  
for free, and with no administrative work, but we can’t (or won’t)  
shell out for hosting. Perhaps this doesn’t matter much to the future  
of RoR, but it would be a shame if commercial enterprises used one  
scheme, and the academic world used another … how will people cross  
this boundary upon graduation?

---

<div class="post-metadata">

**Author:** ![Madoc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@Madoc](https://www.ruby-forum.com/u/Madoc)\
**Post date:** [January 16, 2007, 10:10pm UTC](https://www.ruby-forum.com/t/rails-on-a-cgi-bin-and-rb-focused-web-server/81930/7 "2007-01-16T22:10:35Z")

</div>

> PS. I’m at the “give up” stage, actually. If we measure the effort in  
> learning RoR as X, then the effort in learning to deploy a rails  
> website (not using the test server) is of order X. That is too much  
> pain for something so boring, and requiring so many admin priviledges  
> that (a) you can screw up your machine or (b) a reasonable sysadmin  
> will tell you to get lost.

Don’t give up! Really 😉 I’ve been learning rails for a month or so,  
and  
every step of the way there’s a moment when I’m ready to give up. But  
then somewhere there’s a blog post, and I’m not the person “not getting  
it”. Spirits get restored, and I proceed.

I gave myself a couple of days to install an app with lighhttpd / fcgi  
on textdrive.  
And it was painful, but I got there - with much help from the web.

Then i came across the railsmachine gem which claims to do it all the  
easy way. Have no idea how well it performs, but it was like a light at  
the end of the tunnel, I could now comfort myself that:

_If_ rails use continues with the same growth, many of these niggly  
bits and pieces will become a lot easier. Okay, deployment is hardly  
“bits and pieces”, but I’d wager than in the not so distant future,  
there’ll  
be lots of helpful tools to make this (relatively) painless for a  
newbie.

I started out with asp 1.0 in 97 (iirc) and looking back at the kind of  
cr\*p  
I had to deal with then, and how in a few short years think radically  
improved,  
I have confidence that rails will grow in a similar way.

The big plus for me is that the rails community are a _lot more_  
switched  
on than their counterparts in the asp environment.

---

<div class="post-metadata">

**Author:** ![Madoc](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8491ac/32.png) [@Madoc](https://www.ruby-forum.com/u/Madoc)\
**Post date:** [January 17, 2007, 8:30am UTC](https://www.ruby-forum.com/t/rails-on-a-cgi-bin-and-rb-focused-web-server/81930/8 "2007-01-17T08:30:17Z")

</div>

Keep looking - there’s no shortage of inexpensive hosts that are  
knowledgeable  
and helpful regarding Rails. Shameless plug: I use Site5; they have a  
helpful  
set of forums (they use Rails internally for ticketing/account  
management) and  
at $5/month for 55GB, it should be enough space for any small site…

On 1/16/07, dankelley [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> of RoR, but it would be a shame if commercial enterprises used one  
> scheme, and the academic world used another … how will people cross  
> this boundary upon graduation?
> 
> >

–  
Matt J.  
removed\_email\_address@domain.invalid  
President/Technical Director, Acme Art Company ([acmeartco.org](http://acmeartco.org))
