SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,479
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Cool Starting with Ruby on Rails on Linux

    hi
    I'm quite a bit of novice when it comes to Linux & SSH.
    can anyone tell me how do I create a RoR application in Linux? I've SSH access and below is the directory structure in my root:
    Code:
    mail/
    public_ftp/
    public_html/
    now where do I create the application, here in this main root or in "public_html"? I understand that when I'll create a RoR application, there'll be a "public" directory in that application directory as well which will be the public root. so I'm quite confused here!!

    can anyone help?
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    The public directory should be the site root; all the other directories should be outside of the web root. Does your host's control panel have an option to set the root folder of your site?

  3. #3
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,479
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Cool

    Quote Originally Posted by vgarcia
    The public directory should be the site root; all the other directories should be outside of the web root.
    That I understand, but does that mean that only one application can be installed? what if I want to create an application on a subdomain?

    Quote Originally Posted by vgarcia
    Does your host's control panel have an option to set the root folder of your site?
    well, I've cPanel, so I don't know whether its possible or not. and I wouldn't want to change it since I'd like to run my PHP scripts as well which I don't think I'll be able to do without placing them in public_html, no?
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by asp_funda
    That I understand, but does that mean that only one application can be installed? what if I want to create an application on a subdomain?
    The way my host (dreamhost) has it set up, a subdomain is fully hosted separately from the main domain. So I have vinniegarcia.com and subdomain.vinniegarcia.com at the same level. From there I can add a 'public' directory in subdomain.vinniegarcia.com and have a Rails app completely separate from my main domain. If you have cPanel, I think they do the 'subdomain as subdirectory' approach, and I wouldn't necessarily know how to get it running properly (I guess it would be possible, but only if accessed from subdomain.example.com and never from example.com/subdomain).

    As to your other question, you can have PHP files in the public directory if your host supports PHP. They'll just be processed by the PHP interpreter instead of the Ruby interpreter/FastCGI.

  5. #5
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,479
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Cool

    ah, well, after looking around a bit more, I found that I can create a symbolic link of the application's public directory to the subdomain directory in the "public_html" folder like this:
    Code:
    ln -s /home/<my-username>/<my-app>/public /home/<my-username>/public_html/<the_subdomain>
    the whole application directory can remain outside the "public_html"!! now I just have to check if that works or not!!
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!

  6. #6
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,479
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Cool

    well, it sort of worked. I mean there's more to it than just linking. I'll explain it below & it should apply to all cPanel hosts.

    1. create a rails application outside "public_html" folder, better keep them all in one folder outside "public_html" folder. so lets say I created a folder called "rail_apps" for keeping all of my rails applications.
    2. say I created an application called "MyApp" which I want to be accessible at my.example.com
    3. create a subdomain "my" from cPanel & then rename the "my" folder in the "public_html" folder to anything else or delete it.
    4. now run the following command at SSH
      Code:
      ln -s /home/<my-username>/MyApp/public /home/<my-username>/public_html/my
      this will create a link to the "public" folder of MyApp in "public_html" folder with the name "my" & the application can be accessed at my.example.com
    the path used in the link command is ofcourse indicative, it may differ from host to host & the full path can be found by executing the "pwd" command at SSH.

    sort of complicated for a first timer, huh!!
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •