1

I have a website with a Docker container. So I use the nginx reverse proxy docker with let's encrypt I follow this tutorial

But my website is not working with https.

There is my docker compose file:

services:
  nginx:
    image: pixelfordinner/nginx
    container_name: pixelcloud-nginx_proxy-nginx
    restart: always
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "./volumes/conf.d:/etc/nginx/conf.d:ro"
      - "./volumes/vhost.d:/etc/nginx/vhost.d:ro"
      - "./volumes/certs:/etc/nginx/certs:ro"
      - "/usr/share/nginx/html"
  nginx-proxy:
    image: jwilder/docker-gen
    container_name: nginx-proxy
    depends_on:
      - nginx
    volumes_from:
      - nginx
    volumes:
      - "/var/run/docker.sock:/tmp/docker.sock:ro"
      - "./data/templates:/etc/docker-gen/templates:ro"
      - "./volumes/conf.d:/etc/nginx/conf.d:rw"
    entrypoint: /usr/local/bin/docker-gen -notify-sighup pixelcloud-nginx_proxy-nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
  letsencrypt-nginx-proxy:
    restart: always
    image: jrcs/letsencrypt-nginx-proxy-companion
    container_name: ssl
    depends_on:
      - nginx
      - nginx-proxy
    volumes_from:
      - nginx
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "./volumes/vhost.d:/etc/nginx/vhost.d:rw"
      - "./volumes/certs:/etc/nginx/certs:rw"
    environment:
      - "NGINX_DOCKER_GEN_CONTAINER=pixelcloud-nginx_proxy-docker_gen"
   wordpress:
     image: wordpress
     environment:
      - VIRTUAL_HOST=foo.example.com 
      - LETSENCRYPT_HOST=foo.example.com
      - LETSENCRYPT_EMAIL= [email protected]

I download the nginx.tmpl file from github, and copy it into /data/templates/nginx.tmpl

I don't inderstand what it is not working

Thanks for help!

UPDATE: I managed to setup https instead of http on wordpress. But I have a Gitlab instance with docker compose. On the login page, the https is working, but when I login and go on the project homepage, there is https but the connection is not secure. I would like this: https://gitlab.exemple.com

10
  • Can you explain what isn't working? Are you getting connection refused? Is it a white page with a 500 error? Is it something else? Commented Apr 12, 2017 at 12:10
  • 1
    With https, I have err_connection_reset error and with http, I have 502 bad gateway error Commented Apr 12, 2017 at 12:19
  • Without let's encrypt container, foo.example.com is working, I can surf on my website Commented Apr 12, 2017 at 15:05
  • Can you post your nginx config? Commented Apr 12, 2017 at 15:12
  • Also, as a side-note: Traefik is REALLY good at automating this stuff for you. Take a look :) Commented Apr 12, 2017 at 15:13

1 Answer 1

1

It looks like you are missing the jwilder/docker-gen container that is required by jrcs/letsencrypt-nginx-proxy-companion.

See documentation: https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion#separate-containers-recommended-method

See example: https://github.com/fatk/docker-letsencrypt-nginx-proxy-companion-examples/blob/master/docker-compose/v2/simple-site/docker-compose.yml

It means you will have to add a nginx.tmpl file and mount it to your jwilder/docker-gen container. You will also need to share the /etc/nginx/vhost.d volume from the nginx-proxy container.

Update: The container_name of your service running the docker-gen image should be pixelcloud-nginx_proxy-docker_gen as it needs to match the NGINX_DOCKER_GEN_CONTAINER environment variable. So you should have:

  nginx-proxy:
    image: jwilder/docker-gen
    container_name: pixelcloud-nginx_proxy-docker_gen
Sign up to request clarification or add additional context in comments.

7 Comments

Yes I forgot the nginx.tmpl file.
But even this file, and follow fatk docker compose file, it still not working. (I delete networks).
@Vana Please update your question with your updated docker-compose file. The logs (docker-compose logs) could also be useful.
I update my first post and follow this tutorial github.com/pixelfordinner/pixelcloud-docker-apps
@Vana See my answer update. Please make this change and let me know how it goes. Did you also copy the volumes from the pixelcloud-docker-apps git repository? github.com/pixelfordinner/pixelcloud-docker-apps/tree/master/…
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.