hello community, lets say i have 5 different grai...
# questions
k
hello community, lets say i have 5 different grails apps in development. each has own domain name like www.notepad.com www.library.com www.movies.com ... i was wondering what is the cost effective way to host multiple apps. In this case i have 5 apps but it could be 10 apps. Until now if i have 3 apps i have been buying 3 hetzner servers. So for each i need to pay $5 per month. say i have 10 apps with each having own domain name then i would need 10 servers costing $50. my question is is it possible to put all 10 apps in a single machine hence paying only $5 but the 10 domain names should point to 10 apps although they are on the same server? at least for development phase it would be cost effective or is it not possible and i need to buy 10 separate servers? I appreciate any guide on this from the community. thanks!
m
You should look into setting up a reverse proxy on the server. Then you can run many apps on different ports and forward the requests based on the domain name.
g
If hosting on a $5/mon VM, I assume these are not overly resource heavy, so the same can be done with apache and mod_proxy as well. Separate virtual hosts for the separate apps, proxy to the correct app based on hostname. My guess is that you may want something like a $10 or $20 (multiples of your base cost) VM for 10 apps, but it will depend on resource usage and performance needs.
k
@mattias_reichel @gene thank you mattias and gene. thanks for the reverse proxy suggestion. i have currently 3 apps in action and am paying them separately for different machines. is there a sample example of how to setup reverse proxy and virtual hosts. i dont seem to find it. thanks for the help!
a
nevermind
https://httpd.apache.org/docs/2.4/install.html https://www.howtogeek.com/devops/how-to-set-up-a-reverse-proxy-with-apache/ That's what googling got me after looking at a few other things that were less simplified. If these don't get you there, search around for "httpd mod_proxy" That's what @gene is recommending. It's been a number of years since I've done it. I hear ngnx is another way to go
👍🏼 1
k
@Ari Bustamante thanks for sharing. ill take a look.
g
This year, I started to use nginx-proxy , Found it is extremely convenient. It can proxy up as many as much single apps online, most importantly it can regenerate certs automatically.