V
V
Vasily Mazhekin2019-09-29 15:10:55
ubuntu
Vasily Mazhekin, 2019-09-29 15:10:55

How to install ssl certificate on Ubuntu + docker?

I have an Ubuntu 18 server with docker installed on it. Containers are running in the docker, in which there are sites on nginx. There can be any number of such containers. Purchased domain type site.ru. Each site container is forwarded to an external port. Now they (container sites) look at the world through links.

http://site.ru:8001
http://site.ru:8002 
http://site.ru:8003
etc.
Purchased a digital certificate from a domain provider. There are certificate files. How to install it on sites with minimal effort?

To make it work like this
https://site.ru:8001
https://site.ru:8002 
https://site.ru:8003

And when lifting containers, it was not necessary to fiddle around and mount / install certificates again for each container.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vasily Mazhekin, 2019-10-08
@mazhekin

I figured everything out, created one nginx proxy container, mounted the nginx config and certificate there.
Thanks to the guys from reg.ru helped set up the certificate. (As it turned out, this is not difficult, but I forgot how)
In docker-compose, I created a network like nginx_net.
And then each new container, if I need to set it up on a new port, I configure it not to an external port, but to the nginx_net network. And I open the external port in the proxy container.
Thus , the certificate is forwarded to only one container , and the remaining containers see only the nginx_net docker local network and there is no need to configure each container for external ports, ssl certificates, domains, etc.

V
Vitaly Karasik, 2019-09-29
@vitaly_il1

Have one container with three virtual sites? You can register a certificate once, see for example https://www.linode.com/docs/web-servers/nginx/enab...
Offtopic: it's hard for me to imagine a situation where :port is more convenient than subdomain or site.ru/ site2

C
chupasaurus, 2019-09-29
@chupasaurus

  1. Add the certificate to the host in the directory
  2. Mount it read-only on nginx on the same path
  3. The site config will have the same lines up to the certificate
  4. ?????
  5. PROFIT

M
Mikhail Vasilyev, 2019-09-29
@vasilyevmn

One word - traefik.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question