Configure in Apache two Ruby on Rails apps in the same Server with same IP

apache-2.2phusion-passengerruby-on-rails

I previously ran an two Ruby and Rails applications, one of them by using rails console command, the another one using Apache trough Phusion Passenger. Both applications ran in same IP, the only difference was the application running wih rails console was accesible from port 3000.

Now, I would like to run both apps with Apache, but I know what exactly configure to do that. I read something VirtualHosts, but i don't get it. Considering that I only have one server and one domain, i just used a different port. I tried several times to something similar to this:

<VirtualHost *:80>
    #ServerAdmin @dummy-host.example.com
    DocumentRoot /webserver/myapp/public
    ServerName myapp-Development
    <Directory /webserver/myapp/public>
         AllowOverride all
         Options -MultiViews
    </Directory>
    ErrorLog logs/k2-error_log
    CustomLog logs/k2-access_log common
</VirtualHost>

<VirtualHost *:3000>
    #ServerAdmin @dummy-host.example.com
    DocumentRoot /webserver/myapp2-admin/public
    ServerName myapp2-admin
    <Directory /webserver/myapp2-admin/public>
         AllowOverride all
         Options -MultiViews
    </Directory>
    #ErrorLog logs/k2-error_log
    #CustomLog logs/k2-access_log common
</VirtualHost>

Didn't work, i just have access to the first application by typing the IP in browser.

How can I have 2 RoR applications in same server available in different ports?

OR

OPTIONAL: How can I have myapp2 to run in same port 80, but available in this direction: some.ip.address/admin?

Using CentOS 5.7 in a Amazon EC2 instance.

I found an answer in this question, the problem is that I dont' have a domain to create CNAMES records for subdomains: https://stackoverflow.com/questions/4203580/creating-subdomains-in-amazon-ec2

Best Answer

You probably forgot to edit, ports.conf, you need to add another Listen to make apache bind to that port as well.

Related Topic