增加dashboard登录认证功能

This commit is contained in:
jingrow 2025-06-16 11:05:19 +08:00
parent 009bd2e76b
commit c904c1a661
5 changed files with 24 additions and 8 deletions

6
conf.d/auth.yml Normal file
View File

@ -0,0 +1,6 @@
http:
middlewares:
auth:
basicAuth:
users:
- "admin:$2y$05$2J01B9jv7j6cuQUlX1ySHuM/aLQEeCwLskVJYu1rnH5yta2ltox5i"

9
conf.d/dashboard.yml Normal file
View File

@ -0,0 +1,9 @@
http:
routers:
traefik-dashboard:
rule: "Host(`192.168.2.200`) || Host(`localhost`)"
entryPoints:
- traefik
service: api@internal
middlewares:
- auth

View File

@ -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:

View File

@ -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"

View File

@ -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
entryPoint: web