From e5b9aa5b493f9dd10a1b9ce18b0f19618e697182 Mon Sep 17 00:00:00 2001 From: Kenny Yang Date: Wed, 4 Jun 2025 12:31:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=8F=8D=E5=90=91?= =?UTF-8?q?=E4=BB=A3=E7=90=86=E6=A8=A1=E6=9D=BFURL=E5=B9=B6=E6=B8=85?= =?UTF-8?q?=E7=90=86=E8=AF=81=E4=B9=A6=E7=94=B3=E8=AF=B7=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将反向代理配置文件URL从reverse-proxy.conf改为reverse-proxy-template.conf以使用最新模板 移除证书申请命令中的多余空格保持格式一致 --- local/add_new_app.sh | 4 ++-- reverse-proxy-template.conf | 31 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) create mode 100755 reverse-proxy-template.conf diff --git a/local/add_new_app.sh b/local/add_new_app.sh index a534f8e..8932072 100644 --- a/local/add_new_app.sh +++ b/local/add_new_app.sh @@ -20,7 +20,7 @@ echo "正在注册账户..." # 使用DNS验证申请证书(关键步骤) echo "正在使用DNS验证签发证书..." -~/.acme.sh/acme.sh --issue --dns dns_cf -d "$domain_name" --keylength ec-256 # ECC证书更高效 +~/.acme.sh/acme.sh --issue --dns dns_cf -d "$domain_name" --keylength ec-256 # ECC证书更高效 # 安装证书到指定位置 echo "正在安装证书..." @@ -36,7 +36,7 @@ echo "当前定时任务:" crontab -l | grep acme echo "配置反向代理配置文件..." -wget -O /home/web/conf.d/"$domain_name".conf https://raw.githubusercontent.com/kejilion/nginx/main/reverse-proxy.conf +wget -O /home/web/conf.d/"$domain_name".conf https://raw.githubusercontent.com/kejilion/nginx/main/reverse-proxy-template.conf sed -i "s/yuming.com/$domain_name/g" /home/web/conf.d/"$domain_name".conf sed -i "s/0.0.0.0/$ip_address/g" /home/web/conf.d/"$domain_name".conf sed -i "s/0000/$port/g" /home/web/conf.d/"$domain_name".conf diff --git a/reverse-proxy-template.conf b/reverse-proxy-template.conf new file mode 100755 index 0000000..e08bfdf --- /dev/null +++ b/reverse-proxy-template.conf @@ -0,0 +1,31 @@ +server { + listen 80; + listen [::]:80; + server_name yuming.com; + return 301 https://$host$request_uri; +} + +server { + listen 443 ssl; + listen [::]:443 ssl; + server_name yuming.com; + + ssl_certificate /etc/nginx/certs/yuming.com_cert.pem; + ssl_certificate_key /etc/nginx/certs/yuming.com_key.pem; + + try_files $uri $uri/ /index.php?$args; + + location / { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Range $http_range; + proxy_set_header If-Range $http_if_range; + proxy_redirect off; + proxy_pass http://0.0.0.0:0000; + + #the max size of file to upload + client_max_body_size 20000m; + } +}