Wish Linux tutorial about the port proxy for B4J web-apps

peacemaker

Expert
Licensed User
Longtime User
If there is Linux guru - it would be very useful to have a tutorial how to setup Linux VDS for B4J web-app work.
1) Java web-app works on some custom port.
2) Regular Linux VDS has Nginx and Apache2 software, and they listen to the standard ports, beginning the default 80 HTTP port.
3) And in whole, all must be going on working, but the new web-app is also should work from the root folder of a web-site (web domain) on 80 port also.

If to stop the default Nginx service - B4J web-app can easily work on 80 port, but ... it seems it's incorrect settings (other web-domains also must be working, and also on 80 port).
And how to setup all this - any tutorial is needed.
 

peacemaker

Expert
Licensed User
Longtime User
creating subdomains
Aeric, but it's funny. Each project to be well-looking should be at his own root domain name.
And excepting the main Java web-app at least a web-email-server should be working. And maybe other - and yes, these other services should be on sub-domains, but the main Java app must be on 80 (or 443) port and the root.
 

peacemaker

Expert
Licensed User
Longtime User
Thanks, Aeric, but it's about the routing (passing all from the port). But it seems, here we need the proxying: change the way of a domain and his port.
 

TILogistic

Expert
Licensed User
Longtime User
If there is Linux guru - it would be very useful to have a tutorial how to setup Linux VDS for B4J web-app work.
1) Java web-app works on some custom port.
2) Regular Linux VDS has Nginx and Apache2 software, and they listen to the standard ports, beginning the default 80 HTTP port.
3) And in whole, all must be going on working, but the new web-app is also should work from the root folder of a web-site (web domain) on 80 port also.

If to stop the default Nginx service - B4J web-app can easily work on 80 port, but ... it seems it's incorrect settings (other web-domains also must be working, and also on 80 port).
And how to setup all this - any tutorial is needed.
Thanks, Aeric, but it's about the routing (passing all from the port). But it seems, here we need the proxying: change the way of a domain and his port.
?
Jetty web server

Add proxy
Search
 

peacemaker

Expert
Licensed User
Longtime User
Add proxy
Mostly each Linux server has Nginx as a proxy server, that occupied 80 port (HTTP). And some other software need it, i guess.
Java web-app for HTTP usually uses a free port > 1024, say 50000.

And the task is to setup all so that all work as usual, and in addition to allow the Java web-app (on its own domain) to work with HTTP 80 outer port via his internal port 50000.
I guess, it can be named proxying. How to setup Ubunta 20+?
 

TILogistic

Expert
Licensed User
Longtime User
Apache:
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
As people said to you above, you need a proxy,
I have a server with 4 b4j web apps, 5 static web pages and other services all with ssl, this is all thanks to this app:

it is a setup once, forget for life.
you could also use Ngnix but its configuration is way more difficult than with caddy.
 

Tecuma

Member
Licensed User
As already suggested a reverse proxy suits your needs. There can be some traps using a reverse proxy. Be aware that this is not a "1-click fast setup solution". You should invest some time and try to understand what it is used for and how it works.

There are several solutions possible. A good one is haproxy. There are a lot information about seting up haproxy.
Here are some links I used setting up haproxy.
https://blog.entrostat.com/routing-multiple-domains-using-haproxy-http-and-https-ssl/
https://www.haproxy.com/blog/how-to-map-domain-names-to-backend-server-pools-with-haproxy/
https://unixcop.com/how-to-install-haproxy-on-freebsd/
https://serverfault.com/questions/747895/bind-to-all-interfaces-for-ipv4-and-ipv6-in-haproxy
https://www.haproxy.com/blog/introduction-to-haproxy-logging/
 

hatzisn

Well-Known Member
Licensed User
Longtime User
Mostly each Linux server has Nginx as a proxy server, that occupied 80 port (HTTP). And some other software need it, i guess.
Java web-app for HTTP usually uses a free port > 1024, say 50000.

And the task is to setup all so that all work as usual, and in addition to allow the Java web-app (on its own domain) to work with HTTP 80 outer port via his internal port 50000.
I guess, it can be named proxying. How to setup Ubunta 20+?

All you have to do is go to YouTube and search for Nginx Proxy Manager. There are a lot of videos. Then it is a piece of cake. To install it you will need Docker and Docker-compose. You must see some videos on how they work on YouTube. After all YouTube is an ocean of Knowledge. If I were you I would put between my server and potential visitors, the service of cloudflare. There are lots of benefits from it but the main one is security (it is free for one domain) - also take the magic pill of YouTube. Also do not forget to deactivate Nginx and/or Apache before installing Nginx Proxy Manager.
 
Last edited:

MichalK73

Well-Known Member
Licensed User
Longtime User
There are lot of benefits from it but the main one is security (it is free for one domain)
More than one domain is possible.
I have 4 domains attached to one account.

There is nothing to look for and fumble to make it work. I used CaddyServer which my friend suggested above. It's mega, I got it all in 5 minutes and it works.
 

hatzisn

Well-Known Member
Licensed User
Longtime User
More than one domain is possible.
I have 4 domains attached to one account.

It is a paid account, right? When I did it the maximum number of free domains in accounts was just one. I do not know if this has changed since then.
 

MichalK73

Well-Known Member
Licensed User
Longtime User
It is a paid account, right? When I did it the maximum number of free domains in accounts was just one. I do not know if this has changed since then.
I have a free CF account.
But if I want to extend CF functions, I have to pay for each domain, not for the CF account.
 

hatzisn

Well-Known Member
Licensed User
Longtime User
All you have to do is go to YouTube and search for Nginx Proxy Manager. There are a lot of videos. Then it is a piece of cake. To install it you will need Docker and Docker-compose. You must see some videos on how they work on YouTube. After all YouTube is an ocean of Knowledge. If I were you I would put between my server and potential visitors, the service of cloudflare. There are lots of benefits from it but the main one is security (it is free for one domain) - also take the magic pill of YouTube. Also do not forget to deactivate Nginx and/or Apache before installing Nginx Proxy Manager.

A useful program also that will make your life a lot easier to install a lot of containers in docker including NginxProxyManager is Portainer. Here is a tutorial for portainer:

 
Last edited:
Top