Ram Laxman Yadav bio photo

Ram Laxman Yadav

Ruby on Rails Developer

Email Twitter LinkedIn Github Stackoverflow

Hello There, Today I am going to tell you how you can run multiple rails applications on a single server with different sub urls. I am using ````nginx +passenger``` to run applications.

Here is an implementation how can we run multiple rails applications over a single machine:

Deploy both applications on server:

First step to deploy both application on single server.

Edit nginx configs

run command sudo nano /etc/nginx/site-enabled/APPLICATION_CONFIG and change root and base uri as like following lines of code in the file:

root PATH_OF_FIRST_APP/public;
passenger_base_uri /APP2;

Restart nginx service:

sudo service nginx restart

ln -s PATH_OF_SECOND_APP/public PATH_OF_FIRST_APP/public/APP2

Restart passenger:

touch tmp/restart.txt

Now you can visit your ip/domain, as you can see:

  • www.example.com will be serving the first application.
  • www.example.com/APP2 will be service the second application.