Forum: Ruby on Rails more fcgi problems

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.
D2c735141129932a36eda816dcc3ec91?d=identicon&s=25 John W. (jzwill)
on 2006-05-19 19:44
Finally got fcgi installed with apache. Now whe I click on "About your
application's environment" on the Rails Welcome page, it simply prints
out the dispatch.fcgi script as shown below. I would appreciate any help
I can get on this. I can provide other infomation if necessary.

#!/usr/local/bin/ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for
debugging)
# and the number of requests to process before running garbage
collection.
#
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
# and the GC period is nil (turned off).  A reasonable number of
requests
# could range from 10-100 depending on the memory footprint of your app.
#
# Example:
#   # Default log path, normal GC behavior.
#   RailsFCGIHandler.process!
#
#   # Default log path, 50 requests between GC.
#   RailsFCGIHandler.process! nil, 50
#
#   # Custom log path, normal GC behavior.
#   RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
#
require File.dirname(__FILE__) + "/../config/environment"
require 'fcgi_handler'

RailsFCGIHandler.process!
6ef8cb7cd7cd58077f0b57e4fa49a969?d=identicon&s=25 Brian Hogan (Guest)
on 2006-05-19 20:55
(Received via mailing list)
1. Ensure FastCGIServer is set up in your httpd.conf file to point to
your dispatch.fcgi file
2. Ensure that FastCGI module is loaded
3. Ensure that dispatch.fcgi has execuite privileges enabled for your
web user
4. Ensure that your .htaccess file is directing requests to
dispatch.fcgi
D2c735141129932a36eda816dcc3ec91?d=identicon&s=25 John W. (jzwill)
on 2006-05-19 21:08
Does you see anything wrong with any of this?

1.
<IfModule mod_fastcgi.c>
  FastCgiIpcDir /tmp/fcgi_ipc
  FastCgiServer /usr/local/apache2/htdocs/test/public/dispatch.fcgi \
    -initial-env RAILS_ENV=development \
    -idle-timeout 60
</IfModule>

2.
ll /usr/local/apache2/modules
total 272
-rw-r--r--  1 zwilliam users   8904 May 19 09:52 httpd.exp
-rwxr-xr-x  1 root     root  179916 May 19 09:59 mod_fastcgi.so
-rwxr-xr-x  1 root     root   74577 May 19 10:25 mod_fcgid.so

3.
ll /usr/local/apache2/htdocs/test/public/dispatch.fcgi
-rwxr-xr-x  1 zwilliam apache 901 May 19 11:21
/usr/local/apache2/htdocs/test/public/dispatch.fcgi

4.
# General Apache options
AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain
requests
#
# Example:
#   RewriteCond %{REQUEST_URI} ^/notrails.*
#   RewriteRule .* - [L]

# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
#   RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteEngine On

# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
#   Alias /myrailsapp /path/to/myrailsapp/public
#   RewriteBase /myrailsapp

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]


# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which
will be rendered instead
#
# Example:
#   ErrorDocument 500 /500.html

ErrorDocument 500 "<h2>Application error</h2>Rails application failed to
start properly"


Brian Hogan wrote:
> 1. Ensure FastCGIServer is set up in your httpd.conf file to point to
> your dispatch.fcgi file
> 2. Ensure that FastCGI module is loaded
> 3. Ensure that dispatch.fcgi has execuite privileges enabled for your
> web user
> 4. Ensure that your .htaccess file is directing requests to
> dispatch.fcgi
5ce55767684e0cd1727db2b8b8975640?d=identicon&s=25 Steve Longdo (Guest)
on 2006-05-19 22:19
(Received via mailing list)
Is the shebang line in your dispatch.fcgi file set correctly?
D2c735141129932a36eda816dcc3ec91?d=identicon&s=25 John W. (jzwill)
on 2006-05-19 22:24
I am not sure what the shebang line is. Could you elaborate? Here is my
dispatch.fcgi file:

#!/usr/local/bin/ruby
require File.dirname(__FILE__) + "/../config/environment"
require 'fcgi_handler'
RailsFCGIHandler.process!

Steve Longdo wrote:
> Is the shebang line in your dispatch.fcgi file set correctly?
6ef8cb7cd7cd58077f0b57e4fa49a969?d=identicon&s=25 Brian Hogan (Guest)
on 2006-05-21 17:52
(Received via mailing list)
One thing I see wrong is that you're using FastCGI in Development mode
which is a no-no because it causes memory leaks. Apache + FCGI is for
production. Use Mongrel or WEBrick for development mode.

Shebang line is the first line of the ruby script that starts with #!
At your command prompt, type 'which ruby' and make sure that line 1 of
dispatch.fcgi is the same as the output you get from 'which ruby'
This topic is locked and can not be replied to.