views:

69

answers:

1

I tried just creating a test.rb file putting it in the public directory then calling it like http://localhost:3000/test.rb but that doesn't seem to work. It thinks I'm trying to download the file. What am I missing here? the little script is below:

#!/usr/local/bin/ ruby
print "HTTP/1.0 200 OK\r\n"
print "Content-type: text/html\r\n\r\n"
print "<html><body>Hello World!</body></html>\r\n"
A: 

There's a tiny http daemon server that I use for this sort of thing. I've never heard that you can configure any of the browsers to execute script for you, so you're probably stuck with a similar setup to mine:

You can find shttpd (now called mongoose, from the looks of it) at sourceforge. The config file I use for my ruby apps looks like this:

# SHTTPD web server configuration file.
# Lines starting with '#' and empty lines are ignored.
# For detailed description, visit http://shttpd.sourceforge.net/shttpd.1.txt

#platform-specific stuff
root            c:\main\src\worker\http
systray         no
access_log      logs\shttpd_access_log.txt
error_log       logs\shttpd_error_log.txt
cgi_env         RUBYLIB=c:\main\src\worker;c:\main\src\worker\lib
cgi_interp      c:\InstantRails\ruby\bin\ruby.exe


#platform-dependant stuff
ports           2001
cgi_ext         rb
threads         5
index_files     index.rb

If you have any further questions, just update and I'll try to keep an eye on the thread.

Yeah I saw some stuff online about InstantRails which packages apache, ruby, and mysql together but it didn't appear the project had been updated since 2007. You can set any ruby for the cgi_interp option right?There's also stuff like http://rubyforge.org/projects/fcgi/ fast cgi for ruby for apache which hasn't been updated much either. What's the advantage of mongoose, is it just light compared to setting up apache and using ruby for cgis?
Jeremy T
Also what version of mongoose are you using? http://code.google.com/p/mongoose/ I downloaded the 2.4 version but am having some trouble getting ruby cgis to work on it. The summary page seems to indicate it isn't supported.
Jeremy T