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; + } +}