[Nitro] Nitro Apache2 CGI/FCGI (again)
Erik Howard
erik at kommunicate.net
Thu Dec 29 14:49:21 EST 2005
Kashia Buch wrote:
>Hi,
>
>On Thu, 29 Dec 2005 20:01:03 +0100, Erik Howard <erik at kommunicate.net>
>wrote:
>
>
>>RewriteRule ^(.*)$ *fcgi.rb* [QSA,L]
>>
>>
>
>This produces exactly the same error.
>
>Kash
>
>
Here's the revelant bits i have in my httpd.conf file
*httpd.conf*
LoadModule fastcgi_module libexec/apache2/mod_fastcgi.so
User apacheuser
Group apachegroup
# Important. The following directives come *after*
# User and Group
FastCgiIpcDir /var/tmp/fcgi
FastCgiConfig -initial-env 'RUBYOPT=-rubygems
AddHandler fastcgi-script fcgi fpl rb
# No peeking at my .htaccess files
<FilesMatch "^\.ht">
Order allow,deny
Deny from all
</FilesMatch>
NameVirtualHost *:80
<VirtualHost *:80>
ServerName exaple.com
ServerAlias www.example.com
DocumentRoot /path/to/docroot
<Directory "/path/to/docroot">
Options FollowSymLinks +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
*.htaccess*
RewriteEngine On
RewriteRule ^/$ /index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /fcgi.rb [QSA,L]
To test if you have FastCGI working correctly, you can try the following
script. Dont forget to make the script executable.
*test.fcgi*
#!/usr/bin/env ruby
require 'cgi'
require 'fcgi'
def print_env(title,env)
str = "#{title}:<br>\n<pre>\n"
env.each do |k,v|
str<<"#{k}=#{v}\n"
end
str<< "</pre><p>\n"
end
count = 0
FCGI.each_cgi do |cgi|
count += 1
content = "<title>FastCGI echo</title><h1>FastCGI echo</h1>\n"
content<< sprintf("Request number %d, Process ID: %d<p>\n", count,
Process.$
content<< print_env("Request environment", cgi.env_table)
cgi.out{content}
end
More information about the Nitro-general
mailing list