# Web Ruby w/o Rails

**URL:** <https://www.ruby-forum.com/t/web-ruby-w-o-rails/107608>\
**Category:** Ruby\
**Created:** [June 23, 2007, 11:44pm UTC](https://www.ruby-forum.com/t/web-ruby-w-o-rails/107608 "2007-06-23T23:44:55Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/u/SSSSSSSSS_SSSSSSSS_S)\
**Post date:** [June 23, 2007, 11:44pm UTC](https://www.ruby-forum.com/t/web-ruby-w-o-rails/107608/1 "2007-06-23T23:44:55Z")

</div>

Hi,

I want to start developing a web application in Ruby, but can’t  
configure it  
to work. There are so much options that I get confused 🙂  
eruby, mod\_ruby (which I think, but unsure, is depreciated), cgi,  
fastcgi…

I can’t get the simple “hello world” ☹

I’m with strong C# and PHP background, currently using PHP but hitting  
it’s  
limits for some time now, basically because of the lack of late static  
binding.

I will be very grateful if you help me get started.

Regards,  
Emil I.

---

<div class="post-metadata">

**Author:** ![SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/u/SSSSSSSSS_SSSSSSSS_S)\
**Post date:** [June 24, 2007, 12:34am UTC](https://www.ruby-forum.com/t/web-ruby-w-o-rails/107608/2 "2007-06-24T00:34:00Z")

</div>

Emil - what are you using as a web server? Platform? Configured to  
recognize and run ruby files? You said you can’t get it to work, but  
what does that mean? What happens on the browser? What appears in the  
logs?

---

<div class="post-metadata">

**Author:** ![SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/u/SSSSSSSSS_SSSSSSSS_S)\
**Post date:** [June 24, 2007, 12:56am UTC](https://www.ruby-forum.com/t/web-ruby-w-o-rails/107608/3 "2007-06-24T00:56:02Z")

</div>

Hey Emil,  
If you think it might help and you’re on windows I could send you my  
notes for setting up a web-based ruby-on-rails application. It uses  
lighttpd to serve it up and sqlite for the back end.

Let me know if you want them, maybe they’ll help you get started.

- David

ÃÂ•ÃÂ¼ÃÂ¸ÃÂ» ÃÂ˜ÃÂ²ÃÂ°ÃÂ½ÃÂ¾ÃÂ² / Emil I. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:  
Hi,

I want to start developing a web application in Ruby, but can’t  
configure it  
to work. There are so much options that I get confused 🙂  
eruby, mod\_ruby (which I think, but unsure, is depreciated), cgi,  
fastcgi…

I can’t get the simple “hello world” ☹

I’m with strong C# and PHP background, currently using PHP but hitting  
it’s  
limits for some time now, basically because of the lack of late static  
binding.

I will be very grateful if you help me get started.

## Regards, Emil I.

My place to share my ideas:  
[http://vladev.blogspot.com](http://vladev.blogspot.com)

---

<div class="post-metadata">

**Author:** ![SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/u/SSSSSSSSS_SSSSSSSS_S)\
**Post date:** [June 24, 2007, 3:20am UTC](https://www.ruby-forum.com/t/web-ruby-w-o-rails/107608/4 "2007-06-24T03:20:12Z")

</div>

Hi Emil,

Have you had a look at Camping:  
[http://code.whytheluckystiff.net/camping/](http://code.whytheluckystiff.net/camping/). It looks pretty cool.

It has instructions for serving your app with lighttpd and apache.

Cheers,  
Mark

---

<div class="post-metadata">

**Author:** ![SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/u/SSSSSSSSS_SSSSSSSS_S)\
**Post date:** [September 25, 2007, 11:01pm UTC](https://www.ruby-forum.com/t/web-ruby-w-o-rails/107608/5 "2007-09-25T23:01:17Z")

</div>

> I want to start developing a web application in Ruby, but can’t configure it  
> to work. There are so much options that I get confused 🙂  
> eruby, mod\_ruby (which I think, but unsure, is depreciated), cgi, fastcgi…
> 
> I can’t get the simple “hello world” ☹
> 
> I’m with strong C# and PHP background  
> […]  
> Add an HTTP background and you will be fine. 🙂

> I will be very grateful if you help me get started.

We do not know what environment you are working  
in and what your experience/knowledge is. So,  
sorry if this answer is too basic or trivial.

The most common thing that is very likely to  
be available on whatever web server you are using  
might be CGI. Very likely that your web server has  
a directory called cgi-bin. Ask your sysadmin or

- for Apache - check the httpd.conf to see details.

Assuming your web server has such a directory and  
the execution of CGIs is enabled there (most often  
the default setting), create a file in this directory,  
name it ‘test.rb’ and put the following in this file:

#!/usr/local/bin/ruby  
puts “Content-Type: text/plain\n\n”,  
“Hello world”

Of course,this is a very basic way to work.  
However, using the modules ERB and CGI it is even  
possible to keep design and logic separated.

It doesn’t work?

- chmod 755 test.rb
- Did you forget the two newlines after the Content-Type line?
- Ask the administrator if your web server configured to run CGIs.

HM

---

<div class="post-metadata">

**Author:** ![SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/u/SSSSSSSSS_SSSSSSSS_S)\
**Post date:** [June 24, 2007, 3:39am UTC](https://www.ruby-forum.com/t/web-ruby-w-o-rails/107608/6 "2007-06-24T03:39:17Z")

</div>

??? ??? / Emil I. wrote:

> Hi,
> 
> I want to start developing a web application in Ruby, but can’t  
> configure it  
> to work. There are so much options that I get confused 🙂  
> eruby, mod\_ruby (which I think, but unsure, is depreciated), cgi,  
> fastcgi…
> 
> I can’t get the simple “hello world” ☹

Take a look at Nitro.

Here’s a Web “app” in a Ruby one-liner:

$ ruby -rubygems -e “require ‘nitro’; class C; def index; print   
‘Hello, world!’;end;end; Nitro.start(C)”

Browse to 127.0.0.1:9000 to see the results.

How simple or complex you want your app to be is up to you.

See [http://nitroproject.com/](http://nitroproject.com/)

---

<div class="post-metadata">

**Author:** ![SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/u/SSSSSSSSS_SSSSSSSS_S)\
**Post date:** [September 25, 2007, 11:10pm UTC](https://www.ruby-forum.com/t/web-ruby-w-o-rails/107608/7 "2007-09-25T23:10:52Z")

</div>

On 24 Jun 2007, at 09:16, Ð•Ð¼Ð¸Ð» Ð˜Ð²Ð°Ð½Ð¾Ð² / Emil I. wrote:

> configure it for ruby. I also want that erb to work, but i think I  
> will  
> since it’s written in ruby.

Hi Emil,

If you want some examples of how to do this stuff from scratch, my  
RailsConf Europe presentation from last year is available at http://  
[Camping: Going off the Rails with Ruby](http://www.slideshare.net/feyeleanor/camping-going-off-the-rails-with-ruby).  
A significant proportion of the text covers how to roll your own web  
application framework using WEBrick and the code examples should be  
sufficient for that purpose.

Ellie

## Eleanor McHugh Games With Brains

raise ArgumentError unless @reality.responds\_to? :reason

---

<div class="post-metadata">

**Author:** ![SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/b2d939/32.png) [@SSSSSSSSS\_SSSSSSSS\_S](https://www.ruby-forum.com/u/SSSSSSSSS_SSSSSSSS_S)\
**Post date:** [September 25, 2007, 11:10pm UTC](https://www.ruby-forum.com/t/web-ruby-w-o-rails/107608/8 "2007-09-25T23:10:16Z")

</div>

Thank you for responding so fast to all of you!

The platform is a Windows XP, Apache 2 and 2.2, MySQL 5 as a database.  
(I must have been sleeping while I was writing the post…)

Note that I don’t want any frameworks, although I will check the one you  
suggested - I just want a simple hello world for now.  
The fastcgi module is installed on the apache 2, but I don’t know how to  
configure it for ruby. I also want that erb to work, but i think I will  
since it’s written in ruby.

Regards,  
Emil I.
