【问题标题】:Certbot / letsencrypt Error with [non-www] domain after generating [www] certificateCertbot /letsencrypt 生成 [www] 证书后 [non-www] 域出错
【发布时间】:2020-03-11 04:01:16
【问题描述】:
我使用 certbot 设置了两个站点(以下链接)并输入了“www”。生成 HTTPS 证书时域的一部分导致两个站点的非 www URL 导致错误。
StackOverflow 上有很多类似的问题,但到目前为止还没有解决我的问题。
相关链接
工作域
无效域(因为缺少“www.”)
尝试的修复命令
- sudo certbot certonly --standalone -d fastsitephp.com -d www.fastsitephp.com
- sudo certbot delete --cert-name www.fastsitephp.com
Chrome 将使用上述链接重定向到“www”站点,但是从 Firefox 和 Mobile Safari 可以清楚地看到错误
服务器
- Ubuntu 18.04 LTS 与 Apache
帮助!我可以做些什么来解决这个问题,而无需设置新服务器并更改 URL。理想情况下,服务器将同时支持 www 和非 www;但是,如果无法修复,则 Apache url 重写也是可以接受的。
提前谢谢你!
【问题讨论】:
标签:
apache
ssl-certificate
ubuntu-18.04
lets-encrypt
certbot
【解决方案1】:
我最终自己解决了。主要问题是 Certbot 仍然保留它创建的 HTTP->HTTPS 重定向和一些其他 Apache 配置设置,即使在运行 delete 之后(假设您在原始设置中选择了从 HTTP 到 HTTPS 的重定向)。
如果其他人遇到此问题并需要完全删除 Certbot 生成的证书,这是我使用的命令:
sudo certbot delete
cd /etc/apache2/sites-enabled
ls
sudo nano 000-default.conf
# Remove the redirect
sudo rm 000-default-le-ssl.conf
# Also any file other SSL files such as [000-default-le-ssl.conf.sav]
sudo certbot --apache
# enter both Domains "example.com www.example.com"
sudo service apache2 restart