How to import/change certificate

I have problems to connect to my nextcloud instance from outside reporting an SEC_ERROR_EXPIRED_CERTIFICATE . So it looks like the certificate used by the web server is expired.

But according to my forum post on letsencrypt I have a valid certificate but it seems that the web server is not using it.

Also no certificate seems to be used at all:

pi@nextcloudpi:~ $ sudo -u www-data php /var/www/nextcloud/occ security:certificates                                                                                                                                                        
| File Name | Common Name | Organization | Valid Until | Issued By |                                                                                                                                                                         
pi@nextcloudpi:~ $    

Nextcloud version:
Operating system and version: Raspbian (NextCloudPi v1.21.0)
Apache or nginx version: Apache/2.4.38 (Raspbian)
PHP version: 7.3

The question is how can other certificate be imported? For this I found:

What is meant by /path/to/certificate ?

Symbolic links to Letsencrypt certificates are stored by default in:


After installing or renewing a certificate, you need to reload the webservice.

sudo systemctl reload apache2.service

Or reboot your system.

Perhaps you can use “certbot”.


Thanks for the answers. But the command

sudo -u www-data php /var/www/nextcloud/occ security:certificates

seems not to work. I have two nextcloud instances running on different pis (installed with nextcloudpi). None of them reports a certificate even one of them is working fine.