Skip to content
Advertisement

How to modify the port of https(http) URL?

Originally, I have a website with nginx and Ubuntu 20.04 port at 80(http) and 443(https), the URL is https://mysite.cc (It works well)

And now, I want to set another site with Spring Cloud (Docker) with the URL https://new.mysite.cc

How to set the nginx or the docker of Spring cloud?

Right now, all of the two sites can separatly work well, but how to integrate with them together in one Ubuntu server?

The config of nginx of https://mysite.cc is:

JavaScript

The new site is docker with spring cloud, the part of config file docker-compose.yml is like: (Right now, it works at http://localhost)

JavaScript

Advertisement

Answer

You can setup another server block in your nginx configuration to make it work as a proxy.

You should also change exposed ports for the dockerized application not to collide with the first one.

So change this:

JavaScript

Into for example this:

JavaScript

Proxied communication on one machine doesn’t need to be enciphered as the https config would be set up on the proxy (nginx)

Then the server block could look similarly as this:

JavaScript

I am not mentioning obtaining of the TLS certificate, as you managed to do that for the first application and the process is equal.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement