views:

202

answers:

3

Hi, I've been playing around with rails lately and wanted to go through the deploent process just to see how it worked. I created a simple app with a sIngle model from a scaffold. I uploaded it to my server and found I needed to add /public to the URL to get the 'welcome to rails' screen. However, if I attempted to access my model (public/messages) , I just got a 404 error. Can anyone advise me on what to do?

My server uses rails with fcgi.

Apologies for such a simple question, I've not used rails in the past and am not fully sure how it works yet.

Any advice appreciated.

Thanks.

A: 

You may want to look at deploying your rails app with Passenger's Apache module (aka mod_rails or mod_rack) it's easier and has better performance that fcgi.

makevoid
My server is on shared hosting and I don't have shell access to it
Dan
A: 

setting up rails can be tricky and it varies greatly from host to host.

but if you have set it up correctly you shouldn't have to put /public in your URL. /public is the default directory. so if are looking for the default index.html that rails produces it should be #domain.com/index.html

You'll need to check with your host the correct way of uploading and setting up your app.

PhilCK
A: 

Did you simply upload the application into your website directory, or are you using symbolic links? Normally with cgi/fcgi, you're better off having the actual application in a non-web accessible directory, and a symlink from your public_html/ (or whatever the web directory is called), which points to the app/public/ directory. However, it could be possible to get it to work without symlinks.

Now, the following information is general/generic and encompasses several popular shared Rails hosts. However, it's certainly possible that your host have different settings. In that case, it would very much help if you could tell us which host you're using.

Inside your app/public/ directory, there should be a file called dispatch.fcgi. First of all, verify that this file is there. If it is, make sure that the file is chmodded to 755 and try changing the first line to:

#!/usr/bin/ruby18

if it is:

#!/usr/bin/ruby

(This may vary depending on your host.)

In your app/public/ directory, there should also be a file called .htaccess. In it, change the following line:

RewriteRule ^(.*)$ /dispatch.cgi?$1 [QSA,L]

to:

RewriteRule ^(.*)$ /dispatch.fcgi?$1 [QSA,L]

If neither of these changes work, please post the full contents of dispatch.fcgi, .htaccess and explain the directory structure of your hosting account. As previously stated, letting us know which host you're using would definitely be helpful too.

vonconrad
Hi,will try that when I get back tonight.My host is 34sp btw, I have sent them an email asking for advice.
Dan