Forcing FCGI at dreamhost

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

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

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs