Join the Webbynode Community

Webbynode Forum » Installation & Configuration

Apache + Phusion Passenger & Multiple Rails Applications?

(5 posts)
  1. meskyanichi

    offline
    Member

    Hey Guys!

    I recently decided to just go ahead and learn a bit more about Linux and the command line since I wanted to be able to set up my own rails stack. So I'm currently running Ubuntu 8.04 with Apache2 and Phusion Passenger.

    Thus far, it all works OK! When I type in my IP in the browser, it takes me to the "Welcome aboard!" screen of my Rails test application. So now, I'm trying to figure out how I can be able to run multiple Rails applications within the same VPS. Been looking around some webblogs and such, came across this:

    http://www.aeonscope.net/2009/03/15/phusion-passenger-on-ubuntu/

    Contents of the URL:

    Edit your virtual host file (example: /etc/apache2/sites-available/example) so that the following is used:


    NameVirtualHost *:80
    <VirtualHost *:80>
    ServerName one.example.com
    DocumentRoot /web/one/public

    <Directory /web/one/public/ />
    Option Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow, deny
    allow from all
    </Directory>
    </VirtualHost>

    Repeat the <VirtualHost/> block for each Rails site you want to setup.
    Restart Apache to pick up the new changes by executing the following command line: sudo /etc/init.d/apache2 restart

    So basically what they are saying is "for every rails app, add a new file containing the </VirtualHost> block"?

    Ok, so if I do that, and have two Rails apps running, how do I find a specific app through the browser?

    Cause for example, say I have 2 files located here:
    /etc/apache2/sites-available/rails_app_1
    /etc/apache2/sites-available/rails_app_2

    And I load them both using a2ensite rails_app_1 rails_app_2.

    So, if I wanted to request "rails_app_2" in the browser, how would I do this? What about if I wanted to request "rails_app_1"?

    Because, just typing in the IP to my website, shows only one of the two websites obviously.

    Thanks!

    Meskyanichi
    Ruby on Rails Web Developer
    Twitter: http://twitter.com/meskyanichi/
    Posted 1 year ago #
  2. pygi

    offline
    Member

    Hi,

    in this case you would access your applications in the following manner:

    http://one.example.com
    http://two.example.com

    Please also note that we have a similar article written in howto section. I do plan to rewrite it to be more clear, readable and contain more information in the future however, and would welcome your contribution on it as well.

    Cheers

    Posted 1 year ago #
  3. meskyanichi

    offline
    Member

    Hey Pygi,

    Thanks for the reply.
    So with the example above, I'm actually creating new "subdomains" instead of "normal" domains?
    Hmm. That's actually not what I want. I actually want it in the following manner:

    http://example-one.com/
    http://example-two.com/

    This should be possible right?

    Also, yeah, I looked at the how-to section, but for me (being a beginner with the command-line) it was a little unclear as to how I could get the job done. I assume you are referring to this section?
    Click me!

    Though, I will go ahead and give it a go! ;)

    Posted 1 year ago #
  4. meskyanichi

    offline
    Member

    Ok!

    I have followed the instructions on in the how-to section, though, I might still be doing something wrong.
    The good part is, I am able to access both rails applications now, the not so good part is, when I go to my domain:

    http://final-creation.com/
    To tell the difference:
    http://final-creation.com/fc/users
    http://final-creation.com/sp/users

    I get presented with 2 directories which I can click. Am I going the right way with this? How am I able to
    link final-creation.com to the "fc" directory, and my other domain to the "sp" directory?

    Thanks!

    Posted 1 year ago #
  5. pygi

    offline
    Member

    Hey,

    of course its possible. You just set "ServerName one.example.com" as "ServerName example-one.com" and under it "ServerAlias www.example-one.com". You do similar with the second hostname, with the difference of different domain and path to the rails app.

    Yes, that's the right article as linked in my post ;)

    If you cannot get it working, please poke me on IRC, I'll see what I can do.
    Cheers.

    Posted 1 year ago #

Reply

You must log in to post.