Rails Quickstart Guide

From ReduxWiki

Jump to: navigation, search

[edit] Running under main domain domain.com (root level)

You will need to direct apache to your rails applications public directory, this can be achieved with an ssh (shell) session by creating a symbolic link.

ssh youraccount.com 
rails railsapp 
mv public_html public_html_bak 
ln -s ~/railsapp/public ~/public_html 


[edit] Running non root level or multiple locations

First, create a sub-domain from within cPanel. (example: rails)

Now from shell, remove the directory cPanel has created and replace with a symbolic link to your rails application.

rails railsapp 
cd ~/public_html 
rm -r -f rails 
ln -s ~/railsapp/public ~/public_html/rails 

If your application is already designed, you may merely FTP it to your space. Try not uploading over-top anything in the railsapp/script directory, and leave the .htaccess / dispatch files in the public directory. If these are overwritten, simply change to the railsapp directory and type "rails ." then yes to the files you would like to overwrite.

  • Your railsaap/public directory will need to be set to 755 and nothing higher, including anything contained inside of it. FastCGI may also complicate things greatly, which isn't recommended until your application is production ready.


Trailing Slash Error

Your browser sent a request that this server could not understand.
    Client sent malformed Host header

This means your .htaccess isn’t interpreting the missing slash properly, which is an easy fix.

1. Open the following file: yourapp/public/.htaccess (the .htaccess file is a HIDDEN file, so even if you can’t see it, it’s there, make sure that you can see hidden files).

2. below: RewriteEngine On ADD the following:

RewriteCond %{SCRIPT_FILENAME} -d
RewriteCond %{SCRIPT_FILENAME} ^.*[^\/]$
RewriteRule ^(.*)$ $1/ [N]


Default /index.html indexing to work within public.

RewriteRule ^(.*)$ $1/index.html [N] 
Personal tools