K
K
Kirill Ozeretskovsky2020-03-18 10:04:18
Java
Kirill Ozeretskovsky, 2020-03-18 10:04:18

How to organize several sites (web applications) with Java backend on one VPS?

Several small Java projects are planned. Each of them will have a minimum load, so instead of renting a VPS for each, the idea was to place all of them on one more powerful server.

I plan to pack applications in Jetty Uber Jar and, accordingly, each application will run on some port of its own. As far as I understand, next I need to configure, for example, nginx so that when accessing it, it redirects requests to the appropriate port.

Question: what technology will make nginx itself understand which site is currently being accessed?As far as I understand, DNS settings are needed here, but I don’t know anything about it at all, so at least I understand what I should look for on the Internet or what I should buy from a VPS service provider other than renting a server!? Or what can/should I configure myself on my server?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Robur, 2020-03-18
@OZKA

everyone thinks right.
make your own dns name for each site, direct them all to the same IP where you have nginx running,
then read this link https://nginx.org/en/docs/http/server_names.html
for each web application has its own section server with the corresponding server_name
nginx determines which config to use by dns-name, and the browser sends it when requested.

S
Sergey Gornostaev, 2020-03-18
@sergey-gornostaev

You understand correctly. You don't need to search for anything, just read the Nginx documentation. In particular, about the server_name and proxy_pass directives.

M
mayton2019, 2020-03-19
@mayton2019

In the old Apache it was called - virtual hosting. One Ip - and many names in dns.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question