Deploying with Sub Directories


#1

Hi, I am following this “tutorial” on dreamhost to deploy with sub
directories:

  1. Upload your railsapp to ~/railsapp/.
    ** I have uploaded to /sharemyten.com/list/ (list is my railsapp folder)

  2. Make all necessary changes mentioned in the QuickStart Guide above.
    ** Did this…

  3. Create a symlink at the location you want the subdirectory that
    points to ~/railsapp/public/:
    $ cd ~/yourdomain.com/
    $ ln -s ~/railsapp/public/ railsapp
    **I put: ln -s ~/list/public/ list and I recieve “cannot overwrite
    directory” Does anyone know why I am getting this? Obviously it is
    because “list” is the same name as the folder, but shouldn’t it be?? Am
    I doing something wrong here?

  4. That will mostly work, but your railsapp will still write URLs
    incorrectly. To fix this, add the following line at the end of
    ~/railsapp/config/environment.rb:
    ActionController::AbstractRequest.relative_url_root = “/railsapp”
    **I put this in.

Any help would be greatly appreciated! I have been pulling my hair out
all day today trying to get this thing working.


#2

Nevermind :slight_smile: I got it to work… I found this and it worked:

User Post (2005-08-30 13:30:11 by jwatson)
A much, much easier way to do this (and safer!) is to create your rails
app above your site directory (i.e., /home/username/yourrailsapphere
rather than /home/username/yoursite.com/yourrailsapp). Then all you have
to do is cd to where you want to access your rails app and create a
symlink. For example, let’s create a rails app named foobar that we want
to access from http://yoursite.com/foobar:

[server]$ cd ~
[server]$ rails foobar
[server]$ cd foobar
[server]$ chmod 755 public
[server]$ chmod 755 dispatch*
[server]$ cd …/yoursite.com
[server]$ ln -s …/foobar/public foobar

Now, you should be able to access your rails app at
http://yoursite.com/foobar. No .htaccess modifications required (unless
you want to switch to fastcgi, of course). This should at least get you
working assuming you’re not using a sub-domain, etc.