# apache + fcgid + ruby (gorg) problem

## hujuice

Hello everybody.

I just emerged www-servers/gorg to contribute to the Gentoo Docs translations, but I it doesn't work under Apache.

I cannot manage the problem, I suppose that it's simply because my poor knowledge of FCGI and ruby.  :Embarassed: 

Any help will be appreciated.

When I try to access to some document I get the following error:

```
/var/www/gorg/fcgi-bin/gorg.fcgi:22:in `require': no such file to load -- fcgi (LoadError)

        from /var/www/gorg/fcgi-bin/gorg.fcgi:22
```

where

```
$ ls -l /var/www/gorg/fcgi-bin/gorg.fcgi

lrwxrwxrwx 1 root root 51  5 gen 22.36 /var/www/gorg/fcgi-bin/gorg.fcgi -> /usr/lib/ruby/site_ruby/1.8/gorg/fcgi-bin/gorg.fcgi
```

A generic search indicates that I could lack a

```
# gem install fcgi
```

but it doesn't help.

The configurations are below.

Thanks in advance for the cooperation.  :Smile: 

Regards,

HUjucie

```
<IfDefine FCGID>

LoadModule fcgid_module modules/mod_fcgid.so

SocketPath /var/run/fcgidsock

SharememPath /var/run/fcgid_shm

</IfDefine>
```

```
APACHE2_OPTS="-D DEFAULT_VHOST -D FCGID -D INFO -D LANGUAGE -D PHP5"
```

```
# See vhost.sample

<VirtualHost *:80>

        ServerName gorg.inservibile.org

        ServerAlias gorg

        ServerAdmin hujuice@***

        LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined

        CustomLog /var/log/apache2/gorg-access_log vhost_combined

        ErrorLog /var/log/apache2/gorg-error_log

        LogLevel debug

        AddDefaultCharset utf-8

        DocumentRoot /var/www/gorg/gentoo/xml/htdocs

        <Directory /var/www/gorg/gentoo/xml/htdocs>

                DirectoryIndex index.xml

                Options +Includes -Indexes

                AllowOverride All

                Order Allow,Deny

                Allow from all

                # cgi mode

                #Action gorg /cgi-bin/gorg.cgi

                # fast cgi mode

                Action gorg /fcgi-bin/gorg.fcgi

                # process .xml and .rdf files through gorg

                AddHandler gorg .xml

                AddHandler gorg .rdf

        </Directory>

        ScriptAlias /cgi-bin/ /var/www/gorg/cgi-bin/

        Alias /fcgi-bin/ /var/www/gorg/fcgi-bin/

        <Directory /var/www/gorg/fcgi-bin>

                AllowOverride All

                Options ExecCGI FollowSymLinks

                Order allow,deny

                Allow from all

                # You should use mod_fcgid, but just in case you insist on using mod_fastcgi:

                #<IfModule mod_fastcgi.c>

                #       SetHandler fastcgi-script

                #</IfModule>

                <IfModule mod_fcgid.c>

                        SetHandler fcgid-script

                </IfModule>

        </Directory>

        <Directory /var/www/gorg/cgi-bin>

                AllowOverride All

                Options ExecCGI

                Order allow,deny

                Allow from all

        </Directory>

</VirtualHost>

# You should use mod_fcgid, but just in case you insist on using mod_fastcgi:

#<IfModule mod_fastcgi.c>

#  FastCgiServer /var/www/gorg/fcgi-bin/gorg.fcgi -processes 3 -restart-delay 1 -idle-timeout 300 -appConnTimeout 240

#</IfModule>

<IfModule mod_fcgid.c>

  IdleTimeout 120

  #IdleTimeout n (300 seconds)

  #An idle fastcgi application will be terminated after IdleTimeout seconds.

  IdleScanInterval 30

  #IdleScanInterval n (120 seconds)

  #The scan interval for idle fastcgi applications.

  BusyTimeout 360

  #BusyTimeout n (300 seconds)

  #a fastcgi application will be terminated if handing a single request longer than busy timeout.

  BusyScanInterval 60

  #BusyScanInterval n (120 seconds)

  #The scan interval for busy timeout fastcgi applications.

  ErrorScanInterval 5

  #ErrorScanInterval n (3 seconds)

  #The scan interval for exit pending fastcgi applications.

  #fastcgi applications will be terminated within this scanning.

  ZombieScanInterval 5

  #ZombieScanInterval n (3 seconds)

  #The scan interval for zombie process. 

  ProcessLifeTime 3000

  #ProcessLifeTime n (3600 seconds)

  #A fastcgi application will be terminated if lifetime expired, even no error is detected.

  #SocketPath /var/run

  SocketPath /var/run/fcgid

  #SocketPath path (logs/fcgidsock)

  #The directory to put the UNIX domain socket. (UNIX only)

  SpawnScoreUpLimit 24

  #SpawnScoreUpLimit n (10)

      

  #The spawn-speed control score up water limit.

  #Score increases while a process is spawned or terminated, and decreases as time progresses;

  #while the score is higher than SpawnScoreUpLimit, the spawning will be held for a while.

  #The higher this number is, the higher speed of the spawning can be.

  SpawnScore 3

  #SpawnScore n (1)

  #The weight of spawning.  This weight will be plused to the spawn-control score on every spawn.

  #The higher this number is, the lower speed of spawning can be.

  TerminationScore 1

  #TerminationScore n (2)

  #The weight of termination. This weight will be plused to the score while fastcgi process terminates.

  #The higher this number is, the lower speed of spawning can be.

  MaxProcessCount 16

  #MaxProcessCount n (1000)

  #The max count of total fastcgi process count.

  DefaultMaxClassProcessCount 8

  #DefaultMaxClassProcessCount n (100)

  #The maximum number of fastcgi application instances

  #allowed to run for any one fastcgi application. 

  DefaultInitEnv GORG_CONF /etc/gorg/gorg.conf

  #The default environment variables before a fastcgi application is spawned. You can set this configuration more than once.

  IPCConnectTimeout 10

  #IPCConnectTimeout n (2 seconds)

  #The connect timeout to a fastcgi application.

  IPCCommTimeout 90

  #IPCCommTimeout n (5 seconds)

  #The communication timeout to a fastcgi application.

  OutputBufferSize 0

  #OutputBufferSize n (64k bytes)

  #CGI output cache buffer size. 

</IfModule>
```

```
# /etc/gorg/gorg.conf: Configuration file for Gorg

# Root dir, typically, your DocumentRoot 

# (f)cgi scripts find it in their environment but

# the stand-alone webserver and the search engine need it

#root = "/home/neysx/gentoo.org/gentoo/xml/htdocs"

root = "/var/www/gorg/gentoo/xml/htdocs"

# Mount paths that are not under the root directory (used by stand-alone web server only)

# eg. to mount /cgi-bin which is usually not under the document root

# Note: Those directories will be handled by the stock FileHandler, ie. not by gorg

#mount = /cgi-bin on /home/neysx/gentoo.org/gentoo/xml/cgi-bin

#mount = /images on /home/neysx/gentoo.org/gentoo/xml/images

mount = /cgi-bin on /var/www/gorg/cgi-bin

mount = /fcgi-bin on /var/www/gorg/fcgi-bin

# Should gorg accept cookies and pass $param=$value to the xsl transform

# Default is no (anything but 1 is no)

acceptCookies = 1

# Only read so many lines in xml files to identify stylesheets, use 0 to scan whole file 

headXSL = 12

# Default stylesheet, relative to root dir

defaultXSL = "/xsl/guide.xsl"

# Only used by fastCGI, auto exit after given number of requests (0 means no)

# The fcgi process manager will restart a new instance automatically

# NB: it will NOT exit before at least 1 full minute has elapsed even if you set a very low value

# If you want a really short-lived version, use the cgi instead

# mod_fcgid does its own process recycling and this feature will be obsoleted in an later version

autoKill = 5000

# Allow return of unprocessed xml file if passthru==(anything but 0) appears in URI params

# 0==No, anything else==Yes

passthru = 1

# Pass pathname of requested file in named parameter to the xsl transform

# [a-zA-Z]+ , anything else is ignored and no param is passed

# Default is "link"

linkParam = link

# Pass a param named httphost to the style sheet (== host value from HTTP header)

# 0 or nothing (default) disables this feature

# * will pass the value as received from the user agent or none (http/1.0)

# name alias1 alias2... will pass name when the value sent by the user agent

#                       matches exactly any of name alias1 alias2...

#                       if any alias is *, any value (even nil) will match and name will be passed

# When no value matches, the value received from the user agent is passed

#httphost = mysite www.mysite.org mysite.org alias.mysite.org

# Cache directory. Directory must exist and be writable by whoever runs the server (e.g. apache)

# It must also be writable by the user who runs the stand-alone web server, i.e. not the apache user

# if you want to use both web servers. You can even run both at the same time.

# Default is no cache

#cacheDir = "/var/cache/gorg"

# Number of seconds after which a document is considered too old, 0=never

# Can be used to force a refresh or to stress-test the system

#cacheTTL = 86400 # 1 day

cacheTTL = 864000 # or 10 days

#cacheTTL = 600 # or 10 minutes....

# Use a tree of directories under cacheDir that matches the site tree

# Use when your system has problems coping with a huge single cache dir

# 0 means no tree (all files in cacheDir) and is the default

# If you use this, make sure you clean up the cache with gorg -C regularly

cacheTree = 1

# Max size of cache in megabytes

# Please note that cacheSize is used ONLY when cleaning up either

#    when cacheTree==0 and a clean-up is started based on cacheWash (see below)

# or when cacheTree!=0 and `gorg -C` is run

cacheSize = 250

# Max number of files in a given cache directory

# Please note that this limit is also enforced when cacheTree == 0

# in which case it means the max total number of files in the whole cache

maxFiles = 2000

# Support gzip http encoding (ie. mod_deflate)

# 0 means no compression *and* no support for gzip encoding.

# 1-9 gives compression level, 1 least compressed, 9 max compressed

# Cached pages use the same compression level

# Default is 2

zipLevel = 2

# Clean cache automatically and regularly when a store into the cache occurs.

# gorg cleans up if random(value) < 10, i.e.

# Set to 0 to disable and rely on gorg --clean-cache being run regularly

# a value<=10 means at every call,

# 100 means 10 percent of stores will also clean the cache

# 1000 means 10 permille (cacheSize will be checked only once every 100 stores)

# Note: gorg only tries to clean the dir it caches to, not the whole cache tree

# Use `gorg -C` or `gorg --clean-cache` to clean up whole cache

cacheWash = 0

# Level of logging that goes to syslog

# OFF, FATAL, ERROR, WARN, INFO, DEBUG = 0, 1, 2, 3, 4, 5

logLevel = 4

#

# Used only by stand-alone webserver

#

# Send hit stats to syslog/stderr/a file

accessLog = "syslog"

# Listen on port (must be >1023 to be run by non-root)

port = 8008

#

# Search engine parameters

#

# Connect string, only mysql is supported at the moment

dbConnect  = DBI:mysql:DB_NAME:HOST_NAME

dbUser     = USENAME

dbPassword = PASSWORD

# Document language can be guessed from the document itself with

# an XPath expression. It should return the language code.

# Only the first 5 characters will be used.

# For instance, to use a root element's lang attribute:

xpath_to_lang = /*[1]/@lang

# If no XPath is given or no lang is found, you can use the file path as a fallback:

# define a regexp to apply to the file path, $1 must yield the language

# For instance, the following one applied to '/doc/en/file.xml' returns 'en'

fpath_to_lang = ^/[^/]+/([^/]+)/.*xml$

# include/exclude directives will be processed in the order they appear below.

# First match will be used to either include or exclude the file.

# If no match is found, file is skipped

# Each directive should define one and only one regexp

# Beware, regexp are not shell globs, .xml means any character followed by xml anywhere in the file name

# .+\.xml$  means one or more characters followed by a dot and ending with xml

# Any file that can't be processed, ie. because it is not well-formed will not be indexed

exclude = ^/proj/en/gdp/tests/

exclude = /CVS/

exclude = ^/xsl/

exclude = /draft/

exclude = ^/doc/.+/handbook/2004

exclude = metadoc\.xml$

exclude = /inserts-.+\.xml$

exclude = ^/dyn/

exclude = herds/pkgList.xml

include = ^/.+\.xml$
```

----------

## .:deadhead:.

If you put it not behind apache, does it works?

----------

## hujuice

 *.:deadhead:. wrote:*   

> If you put it not behind apache, does it works?

 

Yes.

HUjuice

----------

