Add SSL to your Nextcloud

Securing your Nextcloud or Owncloud with SSL via Let’s Encrypt.
We need to install the client but for the SSL cert.

sudo apt-get update
sudo apt-get install letsencrypt python-letsencrypt-apache

Now issue the following command to obtain a free SSL certificate.

sudo letsencrypt --apache --agree-tos --email your-email-address -d nextcloud.your-domain.com

lets-encrypt-apache
Pretty much done.

Unless you want to enable HSTS:

sudo nano /etc/apache2/sites-available/nextcloud-le-ssl.conf

Paste the following lines in the file after SSLCertificateKeyFile line.

<IfModule mod_headers.c>
     Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
 </IfModule>

Save and close the file. Then reload Apache.

sudo systemctl reload apache2

Be the first to comment

Leave a Reply