How do I install TLS on my droplet if I have Serverpilot?

February 19, 2019 274 views
WordPress Ubuntu 16.04

Hi, apologies in advance for my general lack of knowledge about this stuff.

I have a Wordpress blog on a DigitalOcean droplet. I installed Serverpilot with this guide: https://serverpilot.io/docs/how-to-connect-a-server-to-serverpilot

Then I installed WP by following this one: https://serverpilot.io/docs/how-to-install-wordpress-on-digitalocean

So that’s worked all fine. It’s just a personal blog site so I don’t need anything crazy.

However, now I’d like to add a TLS/SSL certificate to my site. I found this guide from DO: https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-16-04

But, when I went to start it, I realized that my droplet doesn’t actually have the apache package! I think because of having Serverpilot, if I do dpkg -l | grep apache, it just returns “apache-sp”, which is ServerPilot’s version.

So I’m guessing following that DO TLS guide won’t work, right? For example, I don’t even have a /var/www directory (like you would if you have legit normal apache).

To be honest I don’t really understand why I even have Serverpilot. I just want Wordpress, which it seems like you can install without using SP, right? It seems like to get TLS working with Serverpilot, I might have to pay? Whereas it would be free if I just followed the DO guide, right?

thanks for any tips or advice!

1 Answer

Hi @DOdood ,

Well I would say you follow the tutorial and see if the certbot can actually use the apache version of serverpilot. If this doesn’t work, you could always install the certificate manually.

To install a Let’s Encrypt certificate manually, you can run the following:

sudo /path/to/certbot-auto certonly --webroot -w /var/www/example -d example.com -d www.example.com

This will create a certificate manually hopefully. If this doesn’t work, stop your apache service and run the standalone webserver cerbot offers:

sudo /path/to/certbot-auto certonly --standalone -d example.com -d www.example.com

Once done, it will tell you something like:

Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/www.example.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/www.example.com/privkey.pem
Your cert will expire on 2019-09-23. To obtain a new or tweaked
version of this certificate in the future, simply run certbot
again. To non-interactively renew all of your certificates, run
“certbot renew”

With this certificate, you need to edit your apache vhost and add them in there:

<VirtualHost *:443>
    ServerName www.example.com
    ServerAlias example.com
    DocumentRoot /var/www/example
    ErrorLog /var/www/example/error.log
    CustomLog /var/www/example/requests.log combined
    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/www.example.com/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/www.example.com/privkey.pem
</VirtualHost>

And then restart apache again!

Hope this makes sense. If you need any more assitance please post some output, logs etc.
Trial- and-Error my friend :D

  • Hi, thanks a ton for the reply!

    Okay, so I started the guide install. However, it stopped almost immediately, because trying to do apt install python-certbot-apache told me it depends on python3-certbot-apache. So, I tried installing that first and then it said it needs apache2, which I don’t have:

    DOdood@ubuntu-512mb-nyc3-01:~$ sudo add-apt-repository ppa:certbot/certbot
    # worked
    DOdood@ubuntu-512mb-nyc3-01:~$ sudo apt update
    # good
    DOdood@ubuntu-512mb-nyc3-01:~$ sudo apt install python-certbot-apache
    Reading package lists… Done
    Building dependency tree       
    Reading state information… Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     python-certbot-apache : Depends: python3-certbot-apache but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    
    DOdood@ubuntu-512mb-nyc3-01:~$ sudo apt install python3-certbot-apache
    Reading package lists… Done
    Building dependency tree       
    Reading state information… Done
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:
    
    The following packages have unmet dependencies:
     python3-certbot-apache : Depends: apache2 but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.
    
    So I guess I'll try it manually? However, it looks like your first line has /var/www, which my droplet doesn't even have. Does that matter?
    
    thanks!
    
Have another answer? Share your knowledge.