为什么我的新加密ssl设置会出现浏览器警告?

2 apache security ssl https http

我最近成功安装了Letsencrypt,我的网站似乎与https配合得很好.当我访问它时,例如https://example.com,没有出现错误/警告.但是,当我https://www.example.com在所有浏览器中访问它(包括www)时,我会收到某些警告,例如,在chrome中:

Your connection is not private

Attackers might be trying to steal your information from 
www.example.com (for example, passwords, messages, or credit cards). 

NET::ERR_CERT_COMMON_NAME_INVALID
Run Code Online (Sandbox Code Playgroud)

而在歌剧中:

Opera cannot verify the identity of the server "www.example.com", due to a certificate problem. The server could be trying to trick you.
Run Code Online (Sandbox Code Playgroud)

我的服务器运行apache和https非常好的工作时,不是www.在/etc/letsencrypt/live/www.example.com/我有:

cert.pem  chain.pem  fullchain.pem  privkey.pem
Run Code Online (Sandbox Code Playgroud)

感谢任何帮助,并询问您是否需要进一步的细节.希望这也有助于其他人.

Bar*_*ard 9

这表明该证书对www.example.com无效.

可能有几个原因,包括:

  1. 您在创建证书时未指定此项,仅询问example.com.虽然LetsEncrypt将它放在www.example.com目录中很奇怪,但建议您确实这样做了.

  2. 你在域名中输入了一个拼写错误.

  3. 您在域名和/或端口(443)中包含了协议(http/https).这些不应该在cert请求中,而只是在域名中.

  4. 您拥有example.com和www.example.com的单独证书,并且只有一个在Apache中配置.大多数站点都使用相同的证书,并且两个版本都对域有效.

可能最好查看证书以排除其中的一些.这可以通过在查看https://example.com和/或运行此命令时单击绿色挂锁在浏览器中完成:

openssl x509 -in /etc/letsencrypt/live/www.example.com/cert.pem -text
Run Code Online (Sandbox Code Playgroud)

您还可以使用https://www.ssllabs.com/ssltest/在线工具查看您的SSL设置(实际上我建议您仍然这样做!).