[英]Letsencrypt SSL certificate error
So I deleted the certificate thinking that I needed to do that since I got a new domain name. 因此,我删除了证书,以为自从获得新域名以来我需要这样做。 I am currently stuck with the current error:
我目前陷入当前错误:
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",)
This is what I get when I try to run ./certbot-auto
or ./certbot-auto --apache
. 这是我尝试运行
./certbot-auto
或./certbot-auto --apache
。 Is there any way to fix this issue? 有什么办法可以解决此问题?
If you need any more information let me know. 如果您需要更多信息,请告诉我。
Edit: This is running Ubuntu 14.04.4 编辑:这正在运行Ubuntu 14.04.4
Before getting SSL
for you domain, you need to register your domain in your Apache virtual host, the domain can either be a real domain which you set the DNS
to your server IP, or it can be a fake domain defined in your Ubuntu hosts
file. 在为您的域获取
SSL
之前,您需要在Apache虚拟主机中注册您的域,该域可以是将DNS
设置为服务器IP的真实域,也可以是在Ubuntu hosts
文件中定义的假域。 。
In both ways you need to add your domain to Apache virtual host and then enable it to store a symbolic link from sites-available
into sites-enabled
folder of your Apache. 两种方式都需要将域添加到Apache虚拟主机,然后使它能够存储来自
sites-available
sites-enabled
的符号链接到Apache sites-enabled
文件夹中。
To do that, first you need to cd
into the sites-available
Apache directory using the following command cd /etc/apache2/sites-available/
, then if you ll
from the directory there is a file called 000-default.conf
which is the default setting and configuration of Apache, make a copy from it in that directory (it is good practice to name it the same as your domain name), sudo cp 000-default.conf example.com.conf
, ( sudo
is required because of permission). 要做到这一点,首先需要
cd
到sites-available
的Apache目录使用以下命令cd /etc/apache2/sites-available/
,然后如果你ll
从有一个名为目录000-default.conf
这是Apache的默认设置和配置,请从该目录中进行复制(最好将其命名为您的域名) sudo cp 000-default.conf example.com.conf
,( sudo
是必需的,因为许可)。 After the file is copied open the file using nano
, vim
or whatever terminal editor you are comfortable with. 复制文件后,使用
nano
, vim
或任何您喜欢的终端编辑器打开文件。 sudo nano example.com.conf
. sudo nano example.com.conf
。
When the file is opened configure your domain as the following (set these lines with the proper configuration): 打开文件后,将您的域配置如下(将这些行设置为正确的配置):
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]
After you did the configuration, save the file and exit. 完成配置后,保存文件并退出。 Then use the following command to enable your website and it will make the symbolic link into your
sites-enabled
directory: sudo a2ensite example.com.conf
. 然后,使用以下命令启用您的网站,它将使符号链接进入
sites-enabled
目录: sudo a2ensite example.com.conf
。
Then you only need to restart you Apache sudo systemctl restart apache2.service
. 然后,您只需要重新启动Apache
sudo systemctl restart apache2.service
。 Then you have your domain available and accessible through url and you also can get SSL certificate from letsencrypt
. 然后,您就可以通过url使用和访问您的域,并且还可以从
letsencrypt
获取SSL证书。
PS: You can read more about Apache virtual hosts from these two URLs: Apache Documents and Digitalocean Tutorials PS:您可以从以下两个URL了解有关Apache虚拟主机的更多信息: Apache文档和Digitalocean教程
PS: If you have your previous domain and SSL removed, make sure it has been removed completely from your Apache configuration and virtual host that includes sites-available
, sites-enabled
, and all the files related to your previous domain. PS:如果您已删除了先前的域和SSL,请确保已将其彻底从Apache配置和虚拟主机中删除,其中包括
sites-available
, sites-enabled
以及与先前域相关的所有文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.