Eddie Maiale
Eddie Maiale

Reputation: 67

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. 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

Upvotes: 0

Views: 5373

Answers (1)

TheDevWay
TheDevWay

Reputation: 1413

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.

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.

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). After the file is copied open the file using nano, vim or whatever terminal editor you are comfortable with. 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.

Then you only need to restart you 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.

P.S: You can read more about Apache virtual hosts from these two URLs: Apache Documents and Digitalocean Tutorials

P.S: 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.

Upvotes: 1

Related Questions