Fcgi to run cgi scripts

Dear experts,

I have rail site that is running lighttpd and fcgi. I want the default
domain to serve the rails application, and I also want to have a
virtualhost (bugs.mysite) to resolve to a bugzilla instance.

Bugzilla is basically Perl application called through CGI.

I tried to find pointers on how to set fcgi to run both rails dispatcher
and other cgi scripts in a different virtualhost, and I didn’t find
anything. Would anyone be so kind to show me where to go, or tell me how
to configure fcgi?

Thanks a lot.

Ezra

Here is my current config file:

server.document-root = “/opt/webspace/mysite/public”

server.port = 80
server.username = “apache”
server.groupname = “apache”
server.modules = (“mod_rewrite”,“mod_redirect”,“mod_fastcgi”, “mod_cgi”)

fastcgi.server = (".fcgi" =>
( “railsapp” =>
( “min-procs” => 1,
“max-procs” => 5,
“socket” => “/tmp/ruby-railsapp.fastcgi”,
“bin-path” => “/opt/webspace/mysite/public/dispatch.fcgi”
)
)
)

server.indexfiles = ( “index.html”, “index.cgi” )
server.error-handler-404 = “/dispatch.fcgi”

mimetype.assign = (
“.html” => “text/html”,
“.txt” => “text/plain”,
“.jpg” => “image/jpeg”,
“.png” => “image/png”
)

index-file.names = ( “index.html”, “index.cgi” )

$HTTP[“host”] == “bugs.mysite” {
server.document-root = “/opt/webspace/bugzilla-2.20/”
accesslog.filename = “/Users/USER/Sites/rails/log/access.log”

}

On Feb 6, 2006, at 2:29 PM, Ezra Nugroho wrote:

dispatcher
and other cgi scripts in a different virtualhost, and I didn’t find
anything. Would anyone be so kind to show me where to go, or tell
me how
to configure fcgi?

Thanks a lot.

Ezra

Ezra-

Try this config on for size. I don't think it will work the way you

are doing things. I have left out the mime-types, just add those in
at the bottom. Here are the options for the mod_cgi module:

file-extensions that are handled by a CGI program

e.g.:

cgi.assign = ( “.pl” => “/usr/bin/perl”,
“.cgi” => “/usr/bin/perl” )
Examples

To setup a executable which doesn’t need the help of a external
program you just don’t specify a handler for the extension.

cgi.assign = ( “.sh” => “” )
If the file has no extension keep in mind that lighttpd matches not
the extension itself but the right part of the URL:

cgi.assign = ( “/testfile” => “” )

#########begin lighttpd.conf###############

server.modules = (
“mod_rewrite”,
“mod_redirect”,
“mod_access”,
“mod_fastcgi”,
“mod_cgi”
“mod_compress”,
“mod_accesslog” )

server.document-root = “/var/www”
server.bind = “0.0.0.0”
server.port = 80
server.pid-file = “/tmp/main_lighttpd.pid”
server.tag = “lighttpd”
accesslog.filename = “/var/log/lighttpd.access.log”
server.errorlog = “/var/log/lighttpd.error.log”
server.indexfiles = ( “index.html”, “index.htm”,
“default.htm” )
url.access-deny = ( “~”, “.inc” )

$HTTP[“host”] =~ “(^|www.)example.com” {
server.document-root = “/home/ezra/railsapp/public/”
server.error-handler-404 = “/dispatch.fcgi”
server.indexfiles = ( “dispatch.fcgi”)
server.errorlog = “/home/ezra/railsapp/log/error.typo1.log”
fastcgi.server = ( “.fcgi” =>
( “localhost” =>
( “socket” => “/tmp/railsapp.socket”,
“min-procs” => 2,
“max-procs” => 2,
“bin-path” => “/home/ezra/railsapp/public/dispatch.fcgi”,
“bin-environment” => ( “RAILS_ENV” => “production” )
)))
}

$HTTP[“host”] =~ “bugs.example.com” {
server.document-root = “/opt/webspace/bugzilla-2.20/”
accesslog.filename = “/Users/USER/Sites/rails/log/access.log”
cgi.assign = ( “.pl” => “/usr/bin/perl”,
“.cgi” => “/usr/bin/perl” )
}

add mime-type assigns here

Cheers-
-Ezra Z.
Yakima Herald-Republic
WebMaster

509-577-7732
[email protected]

Oh, one more thing. The mod_cgi module is broken in a few recent
releases of lighttpd. It might only affect 1.4.9 but maybe 1.4.8 too,
im not sure. I do know that it is fixed in the svn repo in 1.4.10.

Cheers-
-Ezra

On Feb 6, 2006, at 2:54 PM, Ezra Z. wrote:

e.g.:
the extension itself but the right part of the URL:
“mod_redirect”,
server.pid-file = “/tmp/main_lighttpd.pid”
server.error-handler-404 = “/dispatch.fcgi”
}


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

-Ezra Z.
Yakima Herald-Republic
WebMaster

509-577-7732
[email protected]

Ezra,

Thanks for your quick response.

This is probably the culprit!
I saw that document about mod_cgi too, and I couldn’t make it work.
That’s why I thought of using mod_fcgi instead.

Hmm… I wonder what my options are…
Is there some other bug tracking package that is friendly with lighttpd
and fcgi?

Do you know about Tract? It uses Python, so I don’t know if it will
complicate the site requirement even further…

Thanks,
Ezra

1.4.8 works fine. 1.4.9 is broken as Ezra mentions.

Zack