Forum: Ruby on Rails fcgi to run cgi scripts

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E5665cfc97733b36ae0849b71576ff74?d=identicon&s=25 Ezra Nugroho (ezran)
on 2006-02-06 23:30
(Received via mailing list)
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"

}
132a94ca65959bda6c74fae54bff2425?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-02-07 00:00
(Received via mailing list)
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 Zygmuntowicz
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
ezra@yakima-herald.com
132a94ca65959bda6c74fae54bff2425?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-02-07 00:06
(Received via mailing list)
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 Zygmuntowicz 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
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>

-Ezra Zygmuntowicz
Yakima Herald-Republic
WebMaster
http://yakimaherald.com
509-577-7732
ezra@yakima-herald.com
E5665cfc97733b36ae0849b71576ff74?d=identicon&s=25 Ezra Nugroho (ezran)
on 2006-02-07 00:23
(Received via mailing list)
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
480cd6d5c2d7ff8d7f83a67137eb794d?d=identicon&s=25 Zack Chandler (Guest)
on 2006-02-07 02:16
(Received via mailing list)
1.4.8 works fine. 1.4.9 is broken as Ezra mentions.

Zack
This topic is locked and can not be replied to.