|
@@ -61,11 +61,21 @@ install_nginx_block() {
|
|
|
rm -f "$staged"
|
|
rm -f "$staged"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+server_names="$PRIMARY_DOMAIN"
|
|
|
|
|
+if [[ "${ENABLE_FUTURE_DOMAIN:-0}" == 1 ]]; then
|
|
|
|
|
+ resolved=$(getent ahostsv4 "$FUTURE_DOMAIN" | awk 'NR==1 {print $1}')
|
|
|
|
|
+ if [[ "$resolved" != 47.93.193.127 ]]; then
|
|
|
|
|
+ echo "$FUTURE_DOMAIN 尚未解析到 47.93.193.127,拒绝启用。" >&2
|
|
|
|
|
+ exit 1
|
|
|
|
|
+ fi
|
|
|
|
|
+ server_names="$PRIMARY_DOMAIN $FUTURE_DOMAIN"
|
|
|
|
|
+fi
|
|
|
|
|
+
|
|
|
http_block=$(mktemp)
|
|
http_block=$(mktemp)
|
|
|
cat >"$http_block" <<EOF
|
|
cat >"$http_block" <<EOF
|
|
|
server {
|
|
server {
|
|
|
listen 80;
|
|
listen 80;
|
|
|
- server_name $PRIMARY_DOMAIN;
|
|
|
|
|
|
|
+ server_name $server_names;
|
|
|
|
|
|
|
|
location ^~ /.well-known/acme-challenge/ {
|
|
location ^~ /.well-known/acme-challenge/ {
|
|
|
root $ACME_ROOT;
|
|
root $ACME_ROOT;
|
|
@@ -91,14 +101,8 @@ certbot certonly --webroot -w "$ACME_ROOT" \
|
|
|
--non-interactive --agree-tos --register-unsafely-without-email \
|
|
--non-interactive --agree-tos --register-unsafely-without-email \
|
|
|
--keep-until-expiring
|
|
--keep-until-expiring
|
|
|
|
|
|
|
|
-server_names="$PRIMARY_DOMAIN"
|
|
|
|
|
cert_name="$PRIMARY_DOMAIN"
|
|
cert_name="$PRIMARY_DOMAIN"
|
|
|
if [[ "${ENABLE_FUTURE_DOMAIN:-0}" == 1 ]]; then
|
|
if [[ "${ENABLE_FUTURE_DOMAIN:-0}" == 1 ]]; then
|
|
|
- resolved=$(getent ahostsv4 "$FUTURE_DOMAIN" | awk 'NR==1 {print $1}')
|
|
|
|
|
- if [[ "$resolved" != 47.93.193.127 ]]; then
|
|
|
|
|
- echo "$FUTURE_DOMAIN 尚未解析到 47.93.193.127,拒绝启用。" >&2
|
|
|
|
|
- exit 1
|
|
|
|
|
- fi
|
|
|
|
|
certbot certonly --webroot -w "$ACME_ROOT" \
|
|
certbot certonly --webroot -w "$ACME_ROOT" \
|
|
|
--cert-name "$PRIMARY_DOMAIN" -d "$PRIMARY_DOMAIN" -d "$FUTURE_DOMAIN" \
|
|
--cert-name "$PRIMARY_DOMAIN" -d "$PRIMARY_DOMAIN" -d "$FUTURE_DOMAIN" \
|
|
|
--non-interactive --agree-tos --register-unsafely-without-email --expand
|
|
--non-interactive --agree-tos --register-unsafely-without-email --expand
|