I’ve setup Certbot on Ubuntu, the certificate was created successfully outputting the following:
Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/bin-depot.co.uk/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/bin-depot.co.uk/privkey.pem
After restarting apache https was not working, it simply failed to connect so I ran:
sudo lsof -iTCP -sTCP:LISTEN -P
…and noted port 443 was not listed to (only port 80).
So I updated default-ssl.conf as shown in steps 3 & 4 here: tutorials/how-to-create-a-ssl-certificate-on-apache-for-ubuntu-14-04
After updating default-ssl.cons I ran:
sudo a2ensite default-ssl.conf
…and got the message that default-ssl was enabled.
I then restarted Apache but am still unable to connect. It appears port 443 is still not configured.
I’m not sure what steps to take next. Any input would be appreciated. The domain is https://bin-depot.co.uk
EDIT:
Suspected virtual host issue. Have tried the following in a file named "bin-depot.co.uk.conf". Fails to activate on "systemctl reload apache2" giving the error "Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.":
SSLCertificateFile /etc/letsencrypt/live/bin-depot.co.uk/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/bin-depot.co.uk/privkey.pem
<VirtualHost *:80>
ServerAdmin dan@***.com
DocumentRoot /var/www/html
<Directory /var/www/html/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
ServerName bin-depot.co.uk
ServerAlias www.bin-depot.co.uk
DocumentRoot /var/www/html
</VirtualHost>
Best Answer
You need to edit
/etc/apache2/ports.conf
. Right now, it saysChange it to:
Next, restart the service. Then, run:
And you'll see
apache2
listening on port 443.