To secure Lighttpd with a Let's Encrypt TLS/SSL certificate on Debian or Ubuntu, you will need to perform the following steps:
sudo apt-get install python3-certbot-nginx
<domain>
with your domain name:sudo certbot certonly --standalone -d <domain>
This will create a certificate and private key pair, and store them in the /etc/letsencrypt/live/<domain>
directory.
/etc/lighttpd/lighttpd.conf
, to include the following lines:$SERVER["socket"] == ":443" { ssl.engine = "enable" ssl.pemfile = "/etc/letsencrypt/live/<domain>/fullchain.pem" ssl.privkey = "/etc/letsencrypt/live/<domain>/privkey.pem" }
sudo service lighttpd restart
https://
instead of http://
.Note that the TLS/SSL certificate issued by Let's Encrypt is only valid for 90 days. You will need to renew the certificate before it expires. To do this, you can run the following command:
sudo certbot renew
This will renew the certificate and update the fullchain.pem
and privkey.pem
files in the /etc/letsencrypt/live/<domain>
directory. You will need to restart Lighttpd to apply the changes.