SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Zealot
    Join Date
    May 2007
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question 1 domain 2 applications

    Hello folks,

    I would like to have 2 different rails applications on the same domain, is it possible ??? In which way do I have to organize them.

    Below an example to explain my needs:

    I have a domain: domain.com and I have 2 rails applications: app1 and app2
    and I would like to organize them in this way:

    app1 on my domain root and app2 with this path domain.com/app2

    I hope it is clear.


    HAVE A GOOD 1 !!!
    Alla prossima ...

  2. #2
    SitePoint Zealot
    Join Date
    May 2007
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Folks, nobody has an answer ????
    Alla prossima ...

  3. #3
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    4,993
    Mentioned
    100 Post(s)
    Tagged
    0 Thread(s)
    possibly:

    app.sitename.com or sitename.com/app

    I don't know which would be best in terns of SEO.

  4. #4
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you have control of the web server? For example, you can use virtual hosts in Apache to point at two different mongrel instances. So say app1 is hosted on mongrel listening on port 3000, and app2 is hosted on a port 3001. You create virtual hosts that map app1.domain.com to port 3000 and app2.domain.com to port 3001.

    The other way is the virtual folder route, where domain.com/app1 points at one app and domain/app2 at the other.

    Either way, you need control of the front end web server so you can figure the mappings.

  5. #5
    SitePoint Zealot
    Join Date
    May 2007
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SpacePhoenix View Post
    possibly:

    app.sitename.com or sitename.com/app

    I don't know which would be best in terns of SEO.
    I did not mean that, see ReggieB's answer
    Alla prossima ...

  6. #6
    SitePoint Zealot
    Join Date
    May 2007
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ReggieB View Post
    Do you have control of the web server? For example, you can use virtual hosts in Apache to point at two different mongrel instances. So say app1 is hosted on mongrel listening on port 3000, and app2 is hosted on a port 3001. You create virtual hosts that map app1.domain.com to port 3000 and app2.domain.com to port 3001.

    The other way is the virtual folder route, where domain.com/app1 points at one app and domain/app2 at the other.

    Either way, you need control of the front end web server so you can figure the mappings.
    Thanks for your answer.
    I don't know, I mean I'm still looking for a web host. usually if the server is not mine but I host my application, is it possible to do what you said ???

    Thanks once again
    Alla prossima ...

  7. #7
    SitePoint Zealot daveporter's Avatar
    Join Date
    Mar 2002
    Location
    Perth, Western Australia
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would ask your hosting company ( or potential hosting company ).

    If they are any good they will recommend the best way to accomplish what you want. If they can't offer a solution look elsewhere...

    HTH - Dave Porter

  8. #8
    SitePoint Zealot
    Join Date
    May 2007
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is what the helpdesk guide says
    Assuming ahead of time that you may eventually want multiple applications, you should make a work directory and then cd into it. You can name it whatever you would like, but this document assumes that it is called "rails".

    % mkdir ~/rails
    % cd ~/rails

    Now you may create your application. As we are just making a simple Hello World application, we'll assume that the application is named "first".

    % rails first
    % cd first

    Next, we're going to set up a subdomain for this application to run on. Log into your cPanel, click on 'subdomains', then type 'first' into the first text box and click 'Add'. You've now created a new subdomain, first.yourdomain.com, which will be the new home of your ruby on rails application. Now, we're going to make your application's "public" directory be the rootdir of that subdomain with the following commands:

    % cd ~/public_html/
    % rm -r first
    % ln -s /home/YOUR_USERNAME/rails/first/public first

    You should now be able to go to http://first.yourdomain.com/, where you will see the Ruby on Rails welcome message. As the welcome page suggests, it is now time to set up your databases.
    If I create a sub-domain for my app2 may I host both application on the same domain. www.mydomain.com (for app1) and app2.mydomain.com (for app 2) ???

    THANK YOU
    Alla prossima ...

  9. #9
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    in the DNS URL www.mydomain.com, the domain is mydomain.com. The www portion is the host name. Therefore, to create app2.mydomain.com, you do not create a subdomain, but rather a new A Host record for app2 in the mydomain.com domain.

  10. #10
    SitePoint Zealot
    Join Date
    May 2007
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ReggieB View Post
    in the DNS URL www.mydomain.com, the domain is mydomain.com. The www portion is the host name. Therefore, to create app2.mydomain.com, you do not create a subdomain, but rather a new A Host record for app2 in the mydomain.com domain.
    Sorry but this means I can not achieve my goal using sub-domain. isn't it ???
    Alla prossima ...

  11. #11
    SitePoint Zealot
    Join Date
    May 2007
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ReggieB View Post
    the virtual folder route, where domain.com/app1 points at one app and domain/app2 at the other.
    In which way can I do that ???
    Alla prossima ...

  12. #12
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is an extract from Apache's http.conf, that will do it:
    Code:
    # ServerName www.company.local:80
    
    NameVirtualHost 10.0.0.1
    
    <VirtualHost www.company.local:80>
      ServerName www.company.local
      DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
    </VirtualHost>
    
    <VirtualHost intranet.company.local:80>
      ServerName intranet.company.local 
      ServerAlias intranet.company.local
      
      ProxyPass / http://intranet.company.local:4000/
      ProxyPassReverse / http://intranet.company.local:4000
      ProxyPreserveHost on
    
    </VirtualHost>
    This example is from a Windows PC running Apache 2 and with an IP address of 10.0.0.1. In this example, normal web pages and Apache apps are being served via www.company.local, and a Rails app is served via intranet.company.local. There's nothing to stop you adding more virtual hosts to point at other Rails apps.

    You need proxy_module and proxy_http_module to get this to work. You also need to create www and intranet Host records on your DNS server both pointing at your web server's IP address (10.0.0.1 in this example).

    You can find information on using virtual host on the Mongrel site:
    http://mongrel.rubyforge.org/docs/apache.html


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
  •