Hosting custom rails


#1

I’m trying to run my app with the 2.1.0 rails and 1.8.7 ruby. I went through the wiki’s on this topic and managed to get both installed and working with little effort. My problem is getting my app hosted using fcgi. In my error.log I keep getting…

"FastCGI: incomplete headers (0 bytes) receive
d from server “/home/jdochert/chapman/public/dispatch.fcgi”

…which I see is a fairly common error. I can run dispatch.fcgi on the command line and it runs without errors. I can access my app from the console without errors. I can also host this app with mongrel on port 3000 without errors. (but I don’t want to pay for a PS)

I’ve tried clearing my sessions from /tmp. I’ve tried resetting the group ownership on all the directories of the app. Neither had any effect. This has to be something in my .htaccess right? Here’s my .htaccess…

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 “

Application error

Rails application failed to start properly”

Free foot rubs to anyone that can help a fella out.


#2

I am getting nowhere with this. I wonder if anyone has managed to get a custom rails install working with Dreamhost’s apache. The frustrating thing is mongrel works perfectly but in order to host it I need to forward from mongrel’s port to port 80 on apache and in order to do that I’m told I need to buy private server. Doesn’t make a lick of sense to me that you’d need to buy your own private server to forward a single port.


#3

I swear…Rails needs its own forum. I’m not a Rails user, but Rails seems by far the most challenging software used at DreamHost. I see so many unanswered Rails posts, probably because a) most people don’t use it, and b) those who do use it struggle with getting their own stuff to work and don’t have time or energy to struggle with someone else’s problems.

-Scott


#4

At least in my case it stems from Dreamhost not using the latest version of Rails. I developed my app using the current latest, 2.1.0 and Dreamhost’s default is 2.0.2. Not sure why they are so slow to update, my guess is they got burned from the 1.*-2.0 update and now are reluctant. I used the latest rails because I assumed any pay-for hosting company would use the latest as a standard but now I’m screwed because Dreamhost doesn’t support my version and my app doesn’t run on theirs. I’d look for a new hosting company but that’s just such a pain in the butt so I’m trying to figure this out.


#5

Then you’ll be happy to hear that Dreamhost is upgrading to 2.1.0. They must like you.

http://www.dreamhoststatus.com/2008/08/12/upgrading-ruby-on-rails-to-version-210/

-Scott


#6

Haha, that’s great news. I must have whined them into submission.


#7

Can I get my free foot rub now?

-Scott