Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
How to generate and use SSL from Let's Encrypt on ServerPilot (for Statamic V1.x)


  • You have already installed Let's Encrypt on your server, if not, follow this link

Let's get started

  1. ssh to production server
  2. sudo as root sudo su
  3. use the following command to generate a new SSL certificate
/home/ubuntu/letsencrypt/letsencrypt-auto certonly --webroot -w /srv/users/serverpilot/apps/app_name/public -d domain.tld -d www.domain.tld

Make sure to replace app_name and domain.tld with the appropriate values.

Once done, your SSL cert will be available in the following folder:


Adding certificate to Server Pilot

  1. Login to ServerPilot
  2. Select the app you would like to add SSL to
  3. Click on the SSL tab
  4. Copy and paste the content of cert.pem into the SSL Cert
  5. Copy and paste the content of privkey.pem into the SSL Key
  6. Save it

Update Statamic settings to accommodate SSL/HTTPS

for V1.x
Edit _config/settings.yaml scroll down to the environments settings, modify your live env value to the following. Don't forget to replace domain.tld to the appropriate domain name.

    - 'https://*domain.tld:80'

Setting up auto renewal

By default, SSL certificates from Let's Encrypt is short-lived (90 days). To automate renewal of these certificates, add the following to the root's cron job

@monthly /home/ubuntu/letsencrypt/letsencrypt-auto certonly --renew-by-default --webroot -w /srv/users/serverpilot/apps/app_name/public -d domain.tld -d www.domain.tld

This comment has been minimized.

Copy link

commented Mar 8, 2016

Could you maybe expand the part at

'Adding certificate to Server Pilot'

for users that are running the free version of serverpilot?


This comment has been minimized.

Copy link
Owner Author

commented Mar 12, 2016

I've written a bash script to generate, install and set renewal for Let's Encrypt SSL for free Serverpilot account

Hopefully this helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.