# Forcing FCGI at dreamhost

**URL:** <https://www.ruby-forum.com/t/forcing-fcgi-at-dreamhost/74145>\
**Category:** Rails\
**Created:** [October 31, 2006, 5:34am UTC](https://www.ruby-forum.com/t/forcing-fcgi-at-dreamhost/74145 "2006-10-31T05:34:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpfeifer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@jpfeifer](https://www.ruby-forum.com/u/jpfeifer)\
**Post date:** [October 31, 2006, 5:34am UTC](https://www.ruby-forum.com/t/forcing-fcgi-at-dreamhost/74145/1 "2006-10-31T05:34:02Z")

</div>

Greetings all,

I’ve got an app in production at dreamhost, but I can’t seem to force  
FCGI on it. I have it enabled for the domain in the admin panel, have  
checked the file permissions in my public folder, and tried firing the  
scripts from the command line.

When firing either dispatch.cgi, or dispatch.fcgi from the command line,  
I get a 500 internal server error on BOTH.

But, if I look at my app in a browser it runs fine but really slow. If  
I go and rename dispatch.cgi the app doesn’t work, so I think it’s  
running under dispatch.cgi

I’ve used pico to resave the files and make sure the line-endings are  
correct too. Is there anything I’m missing to put it into FastCGI, or  
reccomendations for checking or debugging the issue?

Regards,

Jason

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@jpfeifer](https://www.ruby-forum.com/u/jpfeifer)\
**Post date:** [October 31, 2006, 2:02pm UTC](https://www.ruby-forum.com/t/forcing-fcgi-at-dreamhost/74145/2 "2006-10-31T14:02:49Z")

</div>

Jason P. wrote:  
…Is there anything I’m missing to put it into FastCGI, or

> reccomendations for checking or debugging the issue?

What do your logs say?

production.log  
fastcgi.crash.log  
/home/yourusername/logs/yoursite/http/access.log and error.log

Does your .htaccess file specify dispatch.fcgi for fastcgi?

Is the hashbang line in your dispatch.fcgi file set to the correct path  
for the copy of Ruby you want to use?

There are lots of things that can cause the problem you’re having. More  
information would make it easier to solve.

–Al Evans

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@jpfeifer](https://www.ruby-forum.com/u/jpfeifer)\
**Post date:** [October 31, 2006, 4:38pm UTC](https://www.ruby-forum.com/t/forcing-fcgi-at-dreamhost/74145/3 "2006-10-31T16:38:36Z")

</div>

Guest wrote:

> Jason P. wrote:  
> …Is there anything I’m missing to put it into FastCGI, or
> 
> > reccomendations for checking or debugging the issue?
> 
> What do your logs say?
> 
> production.log  
> fastcgi.crash.log  
> /home/yourusername/logs/yoursite/http/access.log and error.log

production.log gives no errors, the app is actually for the most part  
working but very slow in regular cgi. I was having problems from time  
to time with cgi crashing and in error.log I’d get premature end of  
script errors - and checked the shebang and EOF characters.

> Does your .htaccess file specify dispatch.fcgi for fastcgi?

I got it working now in FastCGI. As it turns out, it was something in  
the .htaccess file. I have another app running on my account which runs  
in FastCGI, so I was trying to spot the difference. Eventually I found  
that .htaccess in my public folder had a few extra lines in the app that  
worked.

RewriteRule ^$ index.html [QSA]  
RewriteRule ^([^.]+)$ $1.html [QSA]  
RewriteCond %{REQUEST\_FILENAME} !-f  
RewriteRule ^(._)$ dispatch.fcgi [QSA,L]  
RewriteCond %{REQUEST\_URI} ^/stylesheets._  
RewriteRule .\* - [L]

The last two lines above RewriteCond %{REQUEST\_URI} ^/stylesheets.\*  
and RewriteRule .\* - [L] weren’t in my .htaccess file, I added them and  
boom it worked. I don’t understand why or what they do and would like  
to if anyone knows, but that worked.

Jason

---

<div class="post-metadata">

**Author:** ![jpfeifer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@jpfeifer](https://www.ruby-forum.com/u/jpfeifer)\
**Post date:** [November 7, 2006, 10:48am UTC](https://www.ruby-forum.com/t/forcing-fcgi-at-dreamhost/74145/4 "2006-11-07T10:48:10Z")

</div>

Jason P. wrote:

> But, if I look at my app in a browser it runs fine but really slow. If  
> I go and rename dispatch.cgi the app doesn’t work, so I think it’s  
> running under dispatch.cgi
> 
> I’ve used pico to resave the files and make sure the line-endings are  
> correct too. Is there anything I’m missing to put it into FastCGI, or  
> reccomendations for checking or debugging the issue?

Have you look at the .htaccess file? I think by default it has CGI  
enabled.  
You may have to edit the file and enable the FCGI dispatcher instead.

Hopefully it will work.

Long  
www.edgesoft.ca/blog/read/2
