From c904c1a66161ca2742b631b414ef373486b99c52 Mon Sep 17 00:00:00 2001 From: jingrow Date: Mon, 16 Jun 2025 11:05:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0dashboard=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E8=AE=A4=E8=AF=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf.d/auth.yml | 6 ++++++ conf.d/dashboard.yml | 9 +++++++++ conf.d/{purearthsupplies.yml => website/example.yml} | 9 +++++---- docker-compose.yml | 2 -- traefik.yml | 6 ++++-- 5 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 conf.d/auth.yml create mode 100644 conf.d/dashboard.yml rename conf.d/{purearthsupplies.yml => website/example.yml} (63%) diff --git a/conf.d/auth.yml b/conf.d/auth.yml new file mode 100644 index 0000000..a4744fb --- /dev/null +++ b/conf.d/auth.yml @@ -0,0 +1,6 @@ +http: + middlewares: + auth: + basicAuth: + users: + - "admin:$2y$05$2J01B9jv7j6cuQUlX1ySHuM/aLQEeCwLskVJYu1rnH5yta2ltox5i" \ No newline at end of file diff --git a/conf.d/dashboard.yml b/conf.d/dashboard.yml new file mode 100644 index 0000000..e584149 --- /dev/null +++ b/conf.d/dashboard.yml @@ -0,0 +1,9 @@ +http: + routers: + traefik-dashboard: + rule: "Host(`192.168.2.200`) || Host(`localhost`)" + entryPoints: + - traefik + service: api@internal + middlewares: + - auth \ No newline at end of file diff --git a/conf.d/purearthsupplies.yml b/conf.d/website/example.yml similarity index 63% rename from conf.d/purearthsupplies.yml rename to conf.d/website/example.yml index d831c06..003a3c1 100644 --- a/conf.d/purearthsupplies.yml +++ b/conf.d/website/example.yml @@ -1,12 +1,13 @@ http: routers: main-https: - rule: &host_rule "Host(`purearthsupplies.com`) || Host(`www.purearthsupplies.com`)" + rule: &host_rule "Host(`example.com`) || Host(`www.example.com`)" entryPoints: - websecure service: main-service - tls: - certResolver: myresolver + # 如果需要使用自动申请SSL证书,自动续期等功能,请取消注释以下内容 + # tls: + # certResolver: myresolver main-http-redirect: rule: *host_rule @@ -20,7 +21,7 @@ http: main-service: loadBalancer: servers: - - url: "http://107.174.127.105:3000" + - url: "http://100.100.100.100:3000" # 这里填写你的后端服务地址(上游服务) noop: loadBalancer: servers: diff --git a/docker-compose.yml b/docker-compose.yml index 8916418..c3ec605 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,8 +4,6 @@ services: image: traefik:v3.4 container_name: traefik restart: always - # Enables the web UI and tells Traefik to listen to docker - command: --api.insecure=true --providers.docker ports: # The HTTP port - "80:80" diff --git a/traefik.yml b/traefik.yml index d47a2f4..b62a63c 100644 --- a/traefik.yml +++ b/traefik.yml @@ -3,10 +3,12 @@ entryPoints: address: ":80" websecure: address: ":443" + traefik: + address: ":8080" api: dashboard: true - insecure: true # 生产环境建议关闭 + insecure: false # 生产环境建议关闭 providers: docker: @@ -21,4 +23,4 @@ certificatesResolvers: email: support@jingrow.com storage: acme.json httpChallenge: - entryPoint: web \ No newline at end of file + entryPoint: web