Manage different services on the same port with multiple instances of DietPi Topic is solved
Manage different services on the same port with multiple instances of DietPi
There comes a point when one loves SBCs that one becomes two board computers running DietPi on a single network. It allows you to divvy up different services to different devices based on use case. Managing this is not an issue as long as no other service utilizes the same port on two different devices. It becomes complicated when you have services that require 443/80 or other common ports.
Re: Manage different services on the same port with multiple instances of DietPi
Hi,
honestly I don't understand your issue fully.
If you have more than one device, you could have port 80 used on each of them without problem. Each device can host a web server LISTEN on port 80.
However on a single device, port 80 can be used only once. Multiple web server would ne to be separated by deifferent ports.
But this has nothing to-do with DietPi. This is valid for every system/OS.
honestly I don't understand your issue fully.
If you have more than one device, you could have port 80 used on each of them without problem. Each device can host a web server LISTEN on port 80.
However on a single device, port 80 can be used only once. Multiple web server would ne to be separated by deifferent ports.
But this has nothing to-do with DietPi. This is valid for every system/OS.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Re: Manage different services on the same port with multiple instances of DietPi
I may have misunderstood initially. I know this is not specific to DietPi. How does this work with the domain name then with two devices?
When port forwarding and set up It can only go to one device per port, correct?
When port forwarding and set up It can only go to one device per port, correct?
Re: Manage different services on the same port with multiple instances of DietPi
yes that's a general limitation. However there are solutions available. Easiest one would be running a revers proxy. Your entire traffic on port 80 will be forwarded by your router to the revers proxy. You could configure the revers proxy that way, that it will forward the http request depending on your url/patch. An example
There are some advantages on this.
Another more complicated solution could be using HaProxy viewtopic.php?p=25447#p25447
Code: Select all
https://myDomain.com/application1 > forward to http://192.168.0.20:80
https://myDomain.com/application2 > forward to http://localhost:8080
https://myDomain.com/application3 > forward to http://192.168.0.31:4711
- SSL termination will be done on the revers proxy. You just need 1 certificate for 3 applications. However communication inside your local network will be http only. But yeah it's your local network
- You just need to open port 80 + 443 on your router and you will be able to reach all kind of application. Even if they are not running on 80/443
- Easy way to include more applications to be reachable from the web
Another more complicated solution could be using HaProxy viewtopic.php?p=25447#p25447
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Re: Manage different services on the same port with multiple instances of DietPi
Would it make sense for DietPi to set up web services as behind SSL termination web proxy by default? Then with the helper script to add additions (pointing to other devices) or configure ports.
The concern is that when updating, adding/removing applications that user custom configurations for the web server would break.
The concern is that when updating, adding/removing applications that user custom configurations for the web server would break.
Re: Manage different services on the same port with multiple instances of DietPi
personally I don't think it's a good idea to set up reverse proxy by default. This would force everybody to use a proxy even if not needed. Not everybody needs internet access for it's web applications. As well it's removing flexibility to go with the solution of your choice as it will lock you on a specific scenario.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Re: Manage different services on the same port with multiple instances of DietPi
That's a very recent perspective. Are my concerns valid especially with Dietpi update?
Re: Manage different services on the same port with multiple instances of DietPi
Not sure if I understood your last question. What you do mean be this?
Are my concerns valid especially with Dietpi update?
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Re: Manage different services on the same port with multiple instances of DietPi
My concern is if I set up a reverse proxy and Dietpi updates itself or an application updates/added that it could break the custom configuration for the reverse proxy. Obviously it'll have to be updated for new additions or removals manually for particular programs. However I could envision updating a program/removing and it breaking the entire system where the Web server goes off-line.
Re: Manage different services on the same port with multiple instances of DietPi
that's why it's recommended to perform dietpi-backup before doing any updates
Anyway, dietpi-update should have limited impact on custom config files

Anyway, dietpi-update should have limited impact on custom config files
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team