I already have a Discourse installation set up on Digital Ocean with Docker using the beginner guide. I wish to put a second Rails app on the same droplet. I see that there’s a similar discussion in this topic and this other topic but no specific solution described in detail.
Alternatively a seperate droplet could be used for the other Rails app, but if possible I would like to configure nginx to have them on the same droplet. I’m just not sure how to configure nginx to point to both the Docker Discourse app and a regular Rails app. Any pointers would be appreciated. This seems like it would be a common configuration worth documenting here.
It is also doable with nignx as well, using multiple server {} blocks, and matching the proxy by server_name.
something like:
server {
listen 80;
server_name www.mysite.com;
location / {
proxy_pass http://localhost:4567/; #your rails app port
}
}
server {
listen 80;
server_name forums.mysite.com;
location / {
proxy_pass http://localhost:8080/; #your discourse port as seen by the host
}
}