help with fastcgi

E

Ernest Ellingson

I'm really frustrated.
Is there a site where an example for httpd.conf using ruby fastcgi?

I've looked through all of the threads on fastcgi at ruby-talk. Only
found one example for using fastcgi.

I'm using Apache 2.x

Here is my current httpd.conf relating to fastcgi

LoadModule fastcgi_module modules/mod_fastcgi.so

FastCgiIpcDir logs/fastcgi
ScriptAlias /fcgi-bin/ "/var/www/fcgi/ebw/"

<Directory "/var/www/fcgi/ebw">
AllowOverride All
Options None
Order allow,deny
Allow from all
SetHandler fastcgi-script
</Directory>

AddHandler fastcgi-script .fcgi

when I use my browser to go to http://someDomain/fcgi-bin/login.fcgi

I get an internal server error. The error(s) are:

[Thu Oct 27 11:02:57 2005] [crit] (13)Permission denied: FastCGI: can't
create (dynamic) server "/var/www/fcgi/ebw/login.fcgi": bind() failed
[/etc/httpd/logs/fastcgi/dynamic/d2d6483b03d06cd99ec43408de2a0766]
[Thu Oct 27 11:03:02 2005] [alert] [client 216.27.164.161]
(13)Permission denied: FastCGI: failed to connect to (dynamic) server
"/var/www/fcgi/ebw/login.fcgi": something is seriously wrong, any chance
the socket/named_pipe directory was removed?, see the FastCgiIpcDir
directive
[Thu Oct 27 11:03:02 2005] [error] [client 216.27.164.161] FastCGI:
incomplete headers (0 bytes) received from server
"/var/www/fcgi/ebw/login.fcgi"

Any one have a clue as to what I need to do?

Ernie
 
E

Ernest Ellingson

Ernest said:
I'm really frustrated.
Is there a site where an example for httpd.conf using ruby fastcgi?

I've looked through all of the threads on fastcgi at ruby-talk. Only
found one example for using fastcgi.

I'm using Apache 2.x

Here is my current httpd.conf relating to fastcgi

LoadModule fastcgi_module modules/mod_fastcgi.so

FastCgiIpcDir logs/fastcgi
ScriptAlias /fcgi-bin/ "/var/www/fcgi/ebw/"

<Directory "/var/www/fcgi/ebw">
AllowOverride All
Options None
Order allow,deny
Allow from all
SetHandler fastcgi-script
</Directory>

AddHandler fastcgi-script .fcgi

I figured this out after some serious head scratching.
Here is a short description of getting ruby_fcgi and mod_fastcgi for
Apache to work.

In httpd.conf you must have something like this


<IfModule mod_fastcgi.c>

# URIs that begin with /fcgi-bin/, are found in /var/www/fcgi-bin/
Alias /fcgi-bin/ /var/www/fcgi-bin/
FastCgiIpcDir /var/fcgi/
#FastCgiConfig -autoUpdate

# Anything in here is handled as a "dynamic" server if not defined
as"static" or "external"
<Directory /var/www/fcgi-bin/>
Order allow,deny
Allow from all
SetHandler fastcgi-script
Options +ExecCGI
</Directory>

AddHandler fastcgi-script .fcgi .fpl

#-------------------------------------------------------------------------
# Start a "static" server at httpd initialization

FastCgiServer /var/www/ebw/echo

Alias /ebw/ /var/www/ebw/
</IfModule>
------------End of httpd.conf--------------------------------

----------sample scripts---------------------
A Dynamic fcgi script
It starts and continues to run when browser
points to http://somedomain/fci-bin/ebw/echo.fcgi

cat /var/www/fcgi-bin/ebw/echo.fcgi
#!/usr/local/bin/ruby
require 'rubygems'
require 'fcgi'
require 'cgi'
FCGI.each_cgi {|cgi|
puts cgi.header
puts "Connecting from #{cgi.remote_addr}<br>"
puts "Time is now #{Time.now.strftime("%Y-%m-%d %H:%M:%S")}"
}


A Static fcgi script
It starts when the apache webserver starts
It continues to run
browser points to http://somedomain/ebw/echo #look at Alias in
httpd.conf above.
cat /var/www/ebw/echo
#!/usr/local/bin/ruby
require 'rubygems'
require 'fcgi'
require 'cgi'
FCGI.each_cgi {|cgi|
puts cgi.header
puts "Connecting from #{cgi.remote_addr}<br>"
puts "Time is now #{Time.now.strftime("%Y-%m-%d %H:%M:%S")}"
}

Ernie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top