-
[Ruby on Rails] dispatch.fcgi printed in plain text
I'm trying to setup fastcgi for my application, because I heard it was, well, fast. When I try to set it up though, the dispatch.fcgi file gets printed in plain text in the browser. I have little apache experience and it was years ago, so it's quite possible I'm missing something obvious. I've chmod'd dispatch.fcgi to 755. Here are the contents of my .htaccess file:
-------------------
# 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"
-------------------
Has anyone else seen this problem? Any suggestions on what I can do to fix it?
Thanks,
Branton
-
the answer to your question
AddHandler fcgid-script .fcgi
change it from fastcgi-script to fcgid-script
-
Thanks, QuranCom. That is definitely a step in the right direction. The dispatch.fcgi file was no longer displayed in plain text. Instead, I got a 500 error.
My guess is that there's something wrong with my dispatch.fcgi file. Here it is:
-------------------
!/usr/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!
-------------------
I also wasn't able to find the log file that it references. Does anyone see anything obviously wrong here? If not, any ideas for what else it could be or where I could find more details in a log?
-
I have this same problem with the 500 server error for all apps I copy to the server. If I create them directly on the server they run fine. I see so post of a solution to this topic. What was the solution?
Thanks!
-
Create new rails app
Hi,
try creating a new rails app an then copy everything from your development environment do bluehost except .htacess ans cgi files
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules