From: Brian Candler Date: 2004-11-02T00:32:57+09:00 Subject: Re: fastcgi + eruby > What is the best way to handle .rhtml (eruby) documents using fastcgi? > > I'm using Linux, Apache2 and fcgi 0.8.4. > > I'm trying to convert a site from mod_ruby to fastcgi so I can run some > comparison tests. > > Converting .rbx was easy but I'm not sure how to best handle .rhtml. Tricky, because it's a different way of working. If you change each .rhtml page into a separate fcgi script, then you will have a separate persistent process for every page, which you probably don't want if there are hundreds of pages. You can write a simple fcgi program which reads a filename from the URL, fetches and compiles the appropriate page (or gets it from a cache) and runs it: e.g. http://www.example.com/fcgi-bin/view/foo.rhtml But then your URLs change. You could use mod_rewrite to chomp your URLs into the appropriate new format though. Or you might be able to use "Action handler-name" in the appropriate Directory / Location section. I wouldn't just do it for the fun of it, or for making speed comparisons (almost certainly the speed will be the same or slightly slower than mod_ruby, since you're still doing the eruby work in Ruby, and you have the extra overhead of communicating with a separate worker process rather than the Apache httpd process running the Ruby itself) I'd suggest you only do it if you're moving to an environment where mod_fastcgi is available but mod_ruby isn't. Cheers, Brian.