I am using latest Apache on Linux. I would like to have something like
this:
localhost/query
localhost/query/foobar
All these should be mapped to a specific .rb file but I wonder which
limitation this would have (I’d want to have as few restrictions as
possible), and how to make this even possible at all. Would this require
mod_rewrite or are there simpler alternatives? Preferrable I would not
want to run a daemon .rb file.
Would this require
mod_rewrite or are there simpler alternatives? Preferrable I would not
want to run a daemon .rb file.
You could just make a Ruby cgi script. Then, yes, some mod_rewrite
trickery should get you the desired results.
However, you might want to reconsider running a daemon .rb file. The
main reason that Rails/Rack/etc. go this route is that starting a Ruby
process is often the most intensive part of running a Ruby script
(doubly-so in the case of JRuby). Having a Ruby process idling and
waiting for requests is often more efficient.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.