How to run multiple rails applications on different sub urls with same domain
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
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
Create a symlink for second application
ln -s PATH_OF_SECOND_APP/public PATH_OF_FIRST_APP/public/APP2
Now you can visit your ip/domain, as you can see:
www.example.comwill be serving the first application.
www.example.com/APP2will be service the second application.