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


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

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

<VirtualHost *:443>
    SSLEngine On
    ServerName bin-depot.co.uk
    ServerAlias www.bin-depot.co.uk
    DocumentRoot /var/www/html
  • Could you post your apache2 virtual host config file? My guess is that the certs are not linked correctly. – digijay Nov 11 '18 at 18:10
  • Yes, I think it is a virtualhost issue. Just tried to follow this guide: digitalocean.com/community/tutorials/…. Copied '000-default.conf' and updated to 'bin-depot.co.uk.conf', added what I think is needed for 443/TLS and ran 'systemctl reload apache2' and got 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.' Will append my broken bin-depot.co.uk.conf to my initial question. Sorry guys, I'm new to Ubuntu. – Dan382 Nov 11 '18 at 18:31
  • yepp, that was it. See my answer below. – digijay Nov 11 '18 at 18:52

You need to edit /etc/apache2/ports.conf. Right now, it says

Listen 80

Change it to:

Listen 443

Next, restart the service. Then, run:

netstat -tanp

And you'll see apache2 listening on port 443.

  • Thanks for that, I've now got it listening to the correct port, however when I try and access the site I get the following error: SSL_ERROR_RX_RECORD_TOO_LONG – Dan382 Nov 11 '18 at 18:01

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.