From dbcde8c5be9531f714a523d1fce3f06a0336c5dc Mon Sep 17 00:00:00 2001 From: thehrz Date: Sat, 4 Nov 2023 22:09:58 +0800 Subject: [PATCH] init: initial commit --- Dockerfile | 3 +++ docker-compose.yml | 20 ++++++++++++++++++++ nginx/conf.d/default.conf | 6 ++++++ nginx/conf.d/root.conf | 9 +++++++++ nginx/conf.d/www.conf | 9 +++++++++ 5 files changed, 47 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx/conf.d/default.conf create mode 100644 nginx/conf.d/root.conf create mode 100644 nginx/conf.d/www.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..85d88b9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM nginx:1.19 +WORKDIR /nginx +COPY ./nginx/conf.d /etc/nginx/conf.d diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..9e626e9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: "3.8" + +networks: + traefik: + name: traefik + external: true + +services: + nginx: + build: . + container_name: hfbz-nginx + restart: always + labels: + - traefik.enable=true + - traefik.http.routers.hfbz-nginx.rule=Host(`xn--fiqa592br0dm3gfp6c.com`, `www.xn--fiqa592br0dm3gfp6c.com`) + - traefik.http.routers.hfbz-nginx.entrypoints=web,websecure + - traefik.http.routers.hfbz-nginx.tls.certresolver=letsencrypt + - traefik.http.routers.hfbz-nginx.middlewares=CORS@file + networks: + - traefik diff --git a/nginx/conf.d/default.conf b/nginx/conf.d/default.conf new file mode 100644 index 0000000..87f6c95 --- /dev/null +++ b/nginx/conf.d/default.conf @@ -0,0 +1,6 @@ +server { + listen 80; + listen [::]:80; + + return 403; +} \ No newline at end of file diff --git a/nginx/conf.d/root.conf b/nginx/conf.d/root.conf new file mode 100644 index 0000000..4bafe46 --- /dev/null +++ b/nginx/conf.d/root.conf @@ -0,0 +1,9 @@ +server { + listen 80; + listen [::]:80; + server_name xn--fiqa592br0dm3gfp6c.com; + + location / { + rewrite ^/(.*) https://www.hfbz.com/ permanent; + } +} \ No newline at end of file diff --git a/nginx/conf.d/www.conf b/nginx/conf.d/www.conf new file mode 100644 index 0000000..f2b455a --- /dev/null +++ b/nginx/conf.d/www.conf @@ -0,0 +1,9 @@ +server { + listen 80; + listen [::]:80; + server_name www.xn--fiqa592br0dm3gfp6c.com + + location / { + rewrite ^/(.*) https://www.hfbz.com/ permanent; + } +} \ No newline at end of file