I'm running Ubuntu edgy linux, apache2, php5, and ruby 1.8.4
I've been able to get apache2 to run php scripts easily but am having
problems getting ruby to do so. I've read references to eruby,
libapache2-mod-ruby, fastcgi etc, etc. So, I'm not sure what I really
need. I did install Ubuntu's libapache2-mod-ruby and I now see
/etc/apache2/mods-enabled/ruby.load -> /etc/apache2/mods-available/ruby.load.
I also found a /usr/lib/apache2/modules/mod_ruby.so.
I've tried many variations in the site .conf file in
/etc/apache2/sites-available/www.site.local. What I currently have in
this file is:
<VirtualHost *>
ServerAdmin webmaster@site.local
ServerName www.site.local
ServerAlias site.local
AddHandler cgi-script .rb
DirectoryIndex index.php
DocumentRoot /var/www/site
# CGI Directory
ScriptAlias /cgi-bin/ /var/www/site/
<Location />
Options +ExecCGI
</Location>
# Logfiles
ErrorLog /var/www/site/logs/error.log
CustomLog /var/www/site/logs/access.log combined
</VirtualHost>
Since php is working here is what I have added to /etc/apache2/apache2.conf:
AddType application/x-httpd-php .php
AddType application/x-httpd-php .html
I'm only trying to get apache2 to run ruby programs (.rb files) like it
does .php files. Can someone tell me what is needed to make this work?
When I try to run a test.rb file I'm getting this in the error.log file:
[Fri Dec 08 13:52:30 2006] [error] [client 127.0.0.1] (2)\xd9\x05i\xb7: exec of
'/var/www/site/test.rb' failed
[Fri Dec 08 13:52:30 2006] [error] [client 127.0.0.1] Premature end of script headers: test.rb
and the browser shows:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to
complete your request.
Please contact the server administrator, webmaster@site.local and inform them
of the time the error occurred, and anything you might have done that may have
caused the error.
More information about this error may be available in the server error log.
test.rb just contains this:
#!/usr/bin/ruby
print "Content-type: text/html\r\n\r\n"
print "<html><body>Hello World!</body></html>\r\n"
thanks,
Sam