【问题标题】:How to setup Nginx with Traefik如何使用 Traefik 设置 Nginx
【发布时间】:2021-05-22 15:20:01
【问题描述】:

我需要帮助,

我尝试了很长时间,但我没有设法用 Traefik 设置 Nginx。 码头工人撰写:


services:
  traefik:
    image: traefik:latest
    container_name: traefik
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    networks:
      - proxy
    ports:
      - 80:80
      - 443:443
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./data/traefik.yml:/traefik.yml:ro
      - ./data/acme.json:/acme.json
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.traefik.entrypoints=http"
      - "traefik.http.routers.traefik.rule=Host(`blockworldhd.net`)"
      - "traefik.http.middlewares.traefik-auth.basicauth.users=jan:3065jAnjAn"
      - "traefik.http.middlewares.traefik-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.traefik.middlewares=traefik-https-redirect"
      - "traefik.http.routers.traefik-secure.entrypoints=https"
      - "traefik.http.routers.traefik-secure.rule=Host(`blockworldhd.net`)"
      - "traefik.http.routers.traefik-secure.middlewares=traefik-auth"
      - "traefik.http.routers.traefik-secure.tls=true"
      - "traefik.http.routers.traefik-secure.tls.certresolver=http"
      - "traefik.http.routers.traefik-secure.service=api@internal"
  Nginx:
    image: nginx:latest
    container_name: web
    labels:
      - traefik.backend=Nginx-Pro
      - traefik.frontend.passHostHeader 
      - traefik.frontend.rule=Host:webkonferenz.blockworldhd.net
      - traefik.docker.network=proxy
      - "traefik.port=80"
      - "traefik.frontend.entryPoints=http"
    networks:
      - proxy
    volumes:
      - /var/www/nginx-pro/:/var/www/
      - /etc/nginx/nginx-pro/:/etc/nginx
  proxy:
    external: true 

每次我尝试访问网站时都会出现:404 page not found

我能做什么?

感谢您的帮助!

一月

【问题讨论】:

    标签: docker nginx web webserver traefik


    【解决方案1】:

    你必须为 Nginx 容器配置路由器和服务标签

    试试这样的

        labels:
          - "traefik.enable=true"
          - "traefik.http.routers.nginx.entrypoints=http"
          - "traefik.http.routers.nginx.rule=Host(`######`)
          - "traefik.http.services.nginx.loadbalancer.server.port=80"
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-07
      • 1970-01-01
      • 2018-11-22
      • 2017-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多