【问题标题】:Letsencrypt SSL certificate errorLetsencrypt SSL证书错误
【发布时间】:2017-02-28 06:25:03
【问题描述】:

所以我删除了证书,认为我需要这样做,因为我有一个新域名。我目前遇到了当前的错误:

Root@Site:~$ certbot-auto --apache -d example.io -d www.example.io
Requesting root privileges to run certbot...
/home/maiale/.local/share/letsencrypt/bin/letsencrypt --apache -d example.io -d www.maiale.io
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Error while running apache2ctl configtest.
Action 'configtest' failed.
The Apache error log may have more information.

AH00526: Syntax error on line 35 of /etc/apache2/sites-enabled/000-default-le-ssl.conf:
SSLCertificateFile: file '/etc/letsencrypt/live/maialedesigns.com/cert.pem' does not exist or is empty

The apache plugin is not working; there may be problems with your existing configuration.
The error was: MisconfigurationError("Error while running apache2ctl configtest.\nAction 'configtest' failed.\nThe Apache error log may have more information.\n\nAH00526: Syntax error on line 35 of /etc/apache2/sites-enabled/000-default-le-ssl.conf:\nSSLCertificateFile: file '/etc/letsencrypt/live/example.com/cert.pem' does not exist or is empty\n",)

这是我尝试运行./certbot-auto./certbot-auto --apache 时得到的结果。 有没有办法解决这个问题?

如果您需要更多信息,请告诉我。

编辑:这是运行 Ubuntu 14.04.4

【问题讨论】:

标签: ssl ssl-certificate lets-encrypt


【解决方案1】:

在为您的域获取SSL 之前,您需要在您的Apache 虚拟主机中注册您的域,该域可以是您将DNS 设置为您的服务器IP 的真实域,也可以是假的在您的 Ubuntu hosts 文件中定义的域。

在这两种方式中,您都需要将您的域添加到 Apache 虚拟主机,然后使其能够将来自 sites-available 的符号链接存储到您的 Apache 的 sites-enabled 文件夹中。

为此,首先您需要使用以下命令cd /etc/apache2/sites-available/cd 进入sites-available Apache 目录,然后如果您从目录中ll,则会有一个名为000-default.conf 的文件,这是默认文件Apache 的设置和配置,在该目​​录中复制它(最好将其命名为与您的域名相同的名称),sudo cp 000-default.conf example.com.conf,(由于权限需要sudo)。 复制文件后,使用nanovim 或您喜欢的任何终端编辑器打开文件。 sudo nano example.com.conf

打开文件后,按以下方式配置您的域(使用正确的配置设置这些行):

ServerName www.example.com [You domain name]
ServerAdmin webmaster@localhost [Email of webmaster]
DocumentRoot /var/www/html [The root of you website's files which the domain will open]

完成配置后,保存文件并退出。然后使用以下命令启用您的网站,它将使符号链接进入您的sites-enabled 目录:sudo a2ensite example.com.conf

然后你只需要重启你的 Apache sudo systemctl restart apache2.service。然后您就可以通过 url 访问您的域,您还可以从letsencrypt 获取 SSL 证书。

P.S:您可以通过以下两个 URL 了解更多关于 Apache 虚拟主机的信息:Apache DocumentsDigitalocean Tutorials

P.S:如果您删除了以前的域和 SSL,请确保它已从您的 Apache 配置和虚拟主机中完全删除,其中包括 sites-availablesites-enabled 以及与您以前的域相关的所有文件。

【讨论】:

    猜你喜欢
    • 2020-08-14
    • 1970-01-01
    • 1970-01-01
    • 2013-10-21
    • 2020-09-05
    • 2016-08-19
    • 1970-01-01
    相关资源
    最近更新 更多