今天在用letsencrypt建立SSL時,發現到出現這樣的錯誤訊息

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.

一開始以為是網址DNS尚未成功,所以就沒太大理會,想說稍後再試。

但後來發現試了幾次都還是會報一樣的訊息

 "<html>\r\n<head><title>404 Not Found</title></head>\r\n<body bgcolor=\"white\">\r\n<center><h1>404 Not Found</h1></center>\r\n<hr><center>"

這時就感到很奇怪了,畢竟之前使用都很正常。後來去比對一下這個網址跟之前的配置有甚麼不同。


最終,發現到原因了! 原來letsencrypt使用HTTP方式建立憑證優先走的是IPV6,但我這次忘記在nginx網域配置的conf

加入監聽IPV6,所以導致一直出現404的問題。


那nginx 網址如何監聽IPV6呢?

ipv6.PNG

只需在網域配置的conf

server{

    listen 80;

    listen [::]:80; #加上這個就能監聽IPV6

}

記得更新後要 reload nginx


文章轉載或引用,請先告知並保留原文出處與連結!!(單純分享或非營利的只需保留原文出處,不用告知)

原文連結:
https://blog.aidec.tw/post/letsencrypt-fix-errors