Skip to content

Commit 712fe68

Browse files
committed
Merge branch 'dev': HTTP 放行域名验证路径
2 parents 61ebda1 + 286e36d commit 712fe68

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

‎server/nginx/nginx.conf‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,27 @@ http {
4444
server {
4545
listen 80;
4646
server_name entropydecrease.com www.entropydecrease.com 121.40.24.242;
47-
return 301 https://$host$request_uri;
47+
48+
# 域名归属验证与 ACME http-01 挑战必须在 HTTP 下直接可达:
49+
# 此类验证程序(如阿里云 CDN 域名验证)通常不跟随 301。
50+
#
51+
# 关键:nginx 的 server 级 return 在 SERVER_REWRITE 阶段执行,早于
52+
# location 匹配,若仍将 return 301 置于 server 级,下方 location
53+
# 永不生效。故重定向必须下移至 location /。
54+
location = /verification.html {
55+
root /usr/share/nginx/html;
56+
}
57+
58+
# Let's Encrypt webroot 模式续期预留(standalone 模式不受此影响)。
59+
# 若采用 webroot,需确认 certbot 的 -w 指向宿主机
60+
# /opt/Entropydecrease/website(即容器内 /usr/share/nginx/html)。
61+
location ^~ /.well-known/acme-challenge/ {
62+
root /usr/share/nginx/html;
63+
}
64+
65+
location / {
66+
return 301 https://$host$request_uri;
67+
}
4868
}
4969

5070
# HTTPS 主服务

0 commit comments

Comments
 (0)