Introduction
This guide will walk you through the process of setting up SSL certificates for your Nextcloud instance running on Nextcloud AIO (All-In-One) in a Tails network using Let's Encrypt. Tails (The Amnesic Incognito Live System) is a live Linux distribution designed for secure and anonymous computing, while Let's Encrypt is a free, automated, and open certificate authority.
Prerequisites
Before we begin, ensure that:
- Your Nextcloud AIO server is running on Tails network.
- You have administrative access to the Nextcloud instance.
- You have a stable internet connection.
Installing Certbot
Certbot is a free, automated tool for obtaining and installing SSL certificates from Let's Encrypt. To install Certbot on your Tails system:
- Open a terminal and update the package list:
- Install Certbot:
sudo apt update
sudo apt install certbot
Obtaining Certificates
To obtain SSL certificates for your Nextcloud instance:
- Navigate to the directory where Certbot will store the certificates:
- Run Certbot with the Nextcloud web address and the relevant options:
- Once the process is complete, you will be asked to verify that you own the domain. Follow the instructions provided.
sudo mkdir /etc/letsencrypt
sudo certbot certonly --webroot --webroot-path /var/www/html/nextcloud --email [email protected] --agree-tos --no-eff-email --force-renewal --expand --domains yourdomain.com
Replace yourdomain.com with your actual domain name and [email protected] with your email address.
Configuring Nextcloud
To configure Nextcloud to use the newly obtained SSL certificates:
- Navigate to the Nextcloud configuration file:
- Add the following lines to the file:
- Save and close the file.
- Restart Nginx:
sudo nano /etc/nginx/sites-available/nextcloud
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
sudo systemctl restart nginx
Automating Certificate Renewal
To automate certificate renewal:
- Create a cron job:
- Add the following line to the file:
sudo crontab -e
0 0,12,18,23 * * * certbot renew --quiet --post-hook "service nginx reload"
This will renew the certificates every day at 00:00, 12:00, 18:00, and 23:00.
Conclusion
Congratulations! You have successfully obtained and installed SSL certificates for your Nextcloud instance running on Nextcloud AIO in a Tails network using Let's Encrypt.