Docker Community Forums

Share and learn in the Docker community.

Nginx SSL problem

Hi All,

I m having a problem with a very simple nginx docker implementation on a raspberry pi 2B. I’m trying to setup secure access via port 443, using self signed certs.
HTTP request [port 80] works fine; HTTPS gives " This site can’t be reached" alert.

Some details:
Raspberry Pi 2B - RaspOS
Docker & Docker Compose Installed
Created self signed Certificate with OpenSLL - privatkey and crt
Nginx container has 2 ports open : 80 and 443
Both ports are open and forwarded to the Rasp in my router
My domain name works in http access.

3 binded volumes:

  1. … : /etc/nginx/conf (contains nginx.conf)
  2. … : /usr/share/nginx/html
  3. … : /etc/nginx/certs

Loaded the certificates in the mounted volume
Specified the certificates container location (etc/nginx/certs/…) in the nginx.conf file.
Added the cert file to my Google Chrome on MacOS browser; and cleared the cache.
nginx container starts without errors, and I checked that the certificates are loaded into the container at the correct location in the container (etc/nginx/certs/…). So far so good I thought, but https access keeps producing the " This site can’t be reached" message.
Did I miss something?
PPee

Based on NGINX Docs | NGINX SSL Termination I added a chained key/certificate and changed the nginx.conf in:

events {}

http {
    server {
    listen 80;
    listen 443 ssl;

    server_name jphas.duckdns.org;

    root /home/pi/Nginx/Content/;

    ssl_certificate        /etc/nginx/certs/localhost.crt;
    ssl_certificate_key    /etc/nginx/certs/localhost.key;

    ssl_verify_client       on;
    ssl_trusted_certificate /etc/nginx/certs/chained_lh.pem;
    ssl_ocsp                on; # Enable OCSP validation
    }
}

But no result,
any ideas?
PPee

Hi All,
Still no progress in my efforts to get https access to my nginx docker implementation.
Can somebody explain how it should work. I seem to get a “not secure site” message, because when accessing the host it does not use the in the container installed certificates.
Any help please
PPee