From 276856e38a25cab6fd79c29cdb056622134c21f0 Mon Sep 17 00:00:00 2001 From: zly <644706215@qq.com> Date: Sun, 23 Nov 2025 17:45:27 +0800 Subject: [PATCH] redirect nginx --- web/redirect-root/docker-compose.yml | 21 +++++++++++++++++++++ web/redirect-root/nginx.conf | 8 ++++++++ 2 files changed, 29 insertions(+) create mode 100644 web/redirect-root/docker-compose.yml create mode 100644 web/redirect-root/nginx.conf diff --git a/web/redirect-root/docker-compose.yml b/web/redirect-root/docker-compose.yml new file mode 100644 index 0000000..4c73a19 --- /dev/null +++ b/web/redirect-root/docker-compose.yml @@ -0,0 +1,21 @@ +services: + redirect-root: + image: nginx:alpine + container_name: redirect-root + volumes: + - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro + networks: + - frontend + labels: + - "traefik.enable=true" + + # 根路径重定向 - 最高优先级 + - "traefik.http.routers.redirect-root.rule=Host(`amiap.hzau.edu.cn`) && Path(`/`)" + - "traefik.http.routers.redirect-root.priority=200" + - "traefik.http.routers.redirect-root.entrypoints=websecure" + - "traefik.http.routers.redirect-root.tls.certresolver=myresolver" + - "traefik.http.services.redirect-root-svc.loadbalancer.server.port=80" + +networks: + frontend: + external: true diff --git a/web/redirect-root/nginx.conf b/web/redirect-root/nginx.conf new file mode 100644 index 0000000..5820071 --- /dev/null +++ b/web/redirect-root/nginx.conf @@ -0,0 +1,8 @@ +server { + listen 80; + server_name _; + + location = / { + return 302 /group/; + } +}