nginx、ipv6対応環境でLet'sEnryptのrenewができなくなった
ウェブサイトのssl対応にletsencryptを使用しているが、突然このブログアドレスの証明書が更新できなくなっていた。なんでこれだけダメなんだ...。
以下実行時のエラー。
Cert is due for renewal, auto-renewing...
Renewing an existing certificate for blog.yiorno.com
Performing the following challenges:
http-01 challenge for blog.yiorno.com
Waiting for verification...
Challenge failed for domain blog.yiorno.com
http-01 challenge for blog.yiorno.com
Cleaning up challenges
Some challenges have failed.
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: blog.yiorno.com
Type: unauthorized
Detail: ***: Invalid response from
[http]://blog.yiorno.com/.well-known/acme-challenge/***:
404 #←httpのポートにアクセスしようとしている
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A/AAAA record(s) for that domain
contain(s) the right IP address.
ipv6アドレスが違うらしい。あっているのを確認してから調査。
ウェブサーバーソフトにnginxを使用しているので、その中のこのブログに関する項目を参照した。
nginxでletsencryptを設定すると以下のような項目を自動で追加でき、これによりhttpアクセスがあるとhttpsにリダイレクトされるのだが、blog.yiorno.comのポート80のアドレスにだけipv6の設定を書き忘れていた。凡ミス。
server {rewrite ^(/.well-known/acme-challenge/.*) $1 break; # managed by Certbot
if ($host = blog.yiorno.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
#listen 80; 削除
listen [::]:80; ipv6の設定を追記
server_name blog.yiorno.com;
return 404; # managed by Certbot
location = /.well-known/acme-challenge/*** # managed by Certbot
}
そしてnginxを再起動して反映。なおった!
でもなんで今更発症したんだろうな...。