I don't use Cpanel, I use ssh to access my linux server. I also use Jetty webserver. I don't know man, I think I need to use "virtual hosts". I'm just going to bite the bullet and add another IP to the server. An extra $5 a month.
I mean, you can use Nginx as reverse proxy server in front of Jetty. Just configure Jetty to run multiple apps and then configure Nginx as a front-end.
E.g.: https://www.nginx.com/resources/wiki/start/topics/examples/javaservers/
Ok, so you’re using a Linux server — you will need to configure virtual hosts for the web server you have installed.
For nginx, it’s pretty simple, you just make a new config file for every website, and change the server_name directive. https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04
You can do the same thing using Apache by configuring the ServerName directive. https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-16-04
This enables you to host multiple websites on one IP by having a different domain for each one.
If you want to host multiple websites and access them via the server’s IP, you should create new server configurations and change the port for each one.
That seems like the simplest solution, just change the port for every web server instance. I thought however, it needs to be at port 80(http) or 443(https). Will look into it.
Ok so I found a nice solution. I use cloudflare for easy ssl integration and ddos mitigation. I found a nice app after searching it's app store. It's called portzilla(a reverse proxy), it allows me to easily redirect traffic from any domain to any port number using the same IP address. I'm using it's free trial and it costs around $5 a month, similar to obtaining a second IP, the advantage is that it is easy to manage.