Metal
Metal

Reputation: 205

Hosting two rails app on single server with same IP

I have a server running a rails 3.2 application. It has thin server running on port 3000, apache(proxy) server running on 443.

Is it possible that if I try to host another rails application on the same server by creating a folder under /www and make it run on port 3002 or any other and then another apache for proxy on some other port ?

The new rails app that I have created is in Rails 4 with Ruby 2.0

Please guide.

Upvotes: 0

Views: 637

Answers (2)

Bijendra
Bijendra

Reputation: 10053

use host virtual host configuration specifying different ports for the same ip

 You have multiple domains going to the same IP and also want to serve multiple ports. By defining the ports in the "NameVirtualHost" tag, you can allow this to work. If you try using <VirtualHost name:port> without the NameVirtualHost name:port or you try to use the Listen directive, your configuration will not work. 

Refer Running different sites on different ports.

Server configuration

Listen 80
Listen 8080

NameVirtualHost 172.20.30.40:80
NameVirtualHost 172.20.30.40:8080

<VirtualHost 172.20.30.40:80>
ServerName www.example.com
DocumentRoot /www/domain-80
</VirtualHost>

<VirtualHost 172.20.30.40:8080>
ServerName www.example.com
DocumentRoot /www/domain-8080
</VirtualHost>

Upvotes: 0

Santhosh
Santhosh

Reputation: 29174

Add another VirtualHost for port 3002

<VirtualHost *:3002>
    ServerName your-server-name
    DocumentRoot /www/your-second-app-public-folder-path

    <Directory /www/your-second-app-public-folder-path>
        AllowOverride all
        Options -MultiViews
    </Directory>
</VirtualHost>

Upvotes: 1

Related Questions