0

I have tried in many ways to setup the nginx https configuration in docker environment. But there are not logs showed in the docker nginx logs.

Actually, The website return connection refused or website refused to connect.

docker compose file:

version: "3"
services:
  nginx:
    container_name: nginx
    build:
      context: .
      dockerfile: ./nginx/Dockerfile
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - .:/work
    depends_on:
      - django

  django:
    container_name: django
    build:
      context: .
      dockerfile: ./Dockerfile
    expose:
      - "8000"
    volumes:
      - .:/work
    command: uwsgi --ini ./uwsgi.ini

In nginx conf:

server {
    listen 80;
    server_name  www.canarytechnologies.com;
    rewrite ^(.*)$ https://$server_name$request_uri? permanent;
}

server {

    listen 443 ssl;
    ssl on;
    server_name www.canarytechnologies.com;

    ssl_certificate /etc/nginx/ssl/server.crt;
    ssl_certificate_key /etc/nginx/ssl/server.key;

    ssl_session_timeout 1d;
    ssl_session_cache shared:SSL:50m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ALL:!aNULL:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;

    charset     utf-8;
    client_max_body_size 10m;

    location / {
        include uwsgi_params;
        uwsgi_pass django:8000;
    }

}

I don't set the https, it works fine with 80 port. But I add the https 443 port. There refused to connect and there is no logs in the docker nginx output.

I have successfully setup the server without docker. All the configuration works without the docker environment.

I wondered why add https or add 443 port the server return to refuse connect.

1 Answer 1

0

I made a mistake .

I should add nginx configure file as .conf

So ADD ./nginx/conf/web.conf /etc/nginx/conf.d/web.conf Instead of this

ADD ./nginx/conf/web /etc/nginx/conf.d/web

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.