version: "3.9" services: web: image: nginx container_name: nginx volumes: - /home/ubuntu/docker/nginx/templates:/etc/nginx/templates - /home/ubuntu/docker/nginx/web:/usr/share/nginx/html environment: - NGINX_HOST=mydomain.com - NGINX_PORT=80 labels: - "traefik.enable=true" - "traefik.http.routers.nginx.entrypoints=http" - "traefik.http.routers.nginx.rule=Host(`my.website.com`)" - "traefik.http.middlewares.nginx-https-redirect.redirectscheme.scheme=https" - "traefik.http.routers.nginx.middlewares=nginx-https-redirect" - "traefik.http.routers.nginx-secure.entrypoints=https" - "traefik.http.routers.nginx-secure.rule=Host(`my.website.com`)" - "traefik.http.routers.nginx-secure.tls=true" - "traefik.http.routers.nginx-secure.service=nginx" - "traefik.http.services.nginx.loadbalancer.server.port=80" # - "traefik.http.routers.nginx-secure.middlewares=middlewares-authentik@file" - "traefik.docker.network=proxy" networks: proxy: security_opt: - no-new-privileges:true networks: proxy: external: true