Because is very hard to find such instruction, so i made one.

This instruction is for the alpine nextcloud server on proxmox hypervisor.

Only to do, if you know what you do!!

First:

#for certbot
apk add --update python3 py3-pip

#install certbot
apk add certbot

#install nginx plugin for certbot
apk add certbot certbot-nginx

#create certificate
certbot --nginx

#should tell you that you dont need...
certbot renew


My problem was certbot cant change nginx locations of certificate files, so i need to do it manualy...

Change the location in:
etc/nginx/nginx.conf

The next 2 lines are to change, yourdomain.com schould your domain!

ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

Then:
service nginx restart

Now schould work.

There are 2 ways for automatic reneval:



1. my way

  crontab -e

add the line:

  0 0 * * * certbot renew --nginx --quiet



2. way: (not tested found searching...)

rc-service --list | grep -i crond

when the output is crond then -->  rc-service crond start && rc-update add crond


create script:

#!/bin/sh
python3 -c 'import random; import time; time.sleep(random.random() * 3600)' && sudo certbot renew -q

The location is /etc/periodic/daily/renew_letsencrypt. Save there


chmod a+x /etc/periodic/daily/renew_letsencrypt

validate it:
run-parts --test /etc/periodic/daily

output should be:
/etc/periodic/daily/renew_letsencrypt