Certbot / letsencrypt生成[www]证书后出现[non-www]域的错误

问题描述 投票:0回答:1

我使用certbot设置了两个站点(下面的链接),并输入了“ www”。生成HTTPS证书时域的一部分,导致两个站点的非www URL都导致错误。

关于StackOverflow有很多类似的问题,但到目前为止,还没有一个解决我的问题的。

相关链接

工作域

无效域(由于缺少'www。')

尝试的修复命令

  • sudo certbot certonly --standalone -d fastsitephp.com -d www.fastsitephp.com
  • sudo certbot删除--cert-name www.fastsitephp.com

Chrome将使用上述链接重定向到'www'网站,但是Firefox和Mobile Safari中的错误已清除

服务器

  • 带有Apache的Ubuntu 18.04 LTS

帮助!我可以做些什么来解决此问题,而无需设置新服务器和更改URL。理想情况下,服务器将同时支持www和非www。但是,如果无法解决,则可以重写Apache url。

谢谢您!

apache ssl-certificate ubuntu-18.04 lets-encrypt certbot
1个回答
0
投票

我最终自己解决了。主要问题是,即使在运行delete之后,Certbot仍然保留其创建的HTTP-> HTTPS重定向和其他一些Apache配置设置(这是假设您在原始设置中选择了从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
© www.soinside.com 2019 - 2024. All rights reserved.