Two Rails projects on two different droplets with single domain
Is it possible to use one domain for two Rails projects on two different droplets?
I have two droplets with two different Rails 5 projects (ubuntu 18, nginx, puma). One for the website and another for API (backend for mobile app).
I mean that I want to buy example.com domain. After that, I want to use example.com for website and api.example.com for API. I think that I should make some work with nginx config? Should I use private IP? Which droplet should process traffic depending on url?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.