Nextcloudpi - Letsencrypt certificate issue + httpd down

Hello,

I had a NextcloudPi install running with external access for several months. A few days ago, I wanted to access my Nextcloud from a new phone and the browser would not load the webpage, mentioning “Unsecure connection”. It was working well on other devices.

I tried to renew the certificate without any success.

I may have broken something as now httpd and Apache are not working anymore. I do not have web access anymore to Nextcloud nor to NextcloudPi.
It seems httpd does not start because there is no certificate, but I cannot have a new certificate from Letsencrypt. I tried to restore the ncp config that I saved a few months ago without any positive change on my issues.

Could someone help me solve this please?

Problems:
HTTPD service down

HTTPd logs
[Thu Aug 19 19:22:40.855945 2021] [ssl:emerg] [pid 2316:tid 3069297168] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/nc-error.log for more information
AH00016: Configuration Failed

nc-error.log
[Thu Aug 19 19:22:40.855718 2021] [ssl:emerg] [pid 2316:tid 3069297168] AH02572: Failed to configure at least one certificate and key for zacans.mooo.com:443
[Thu Aug 19 19:22:40.855915 2021] [ssl:emerg] [pid 2316:tid 3069297168] SSL Library Error: error:140A80B1:SSL routines:SSL_CTX_check_private_key:no certificate assigned

Trying to start httpd
sudo service httpd start
Failed to start httpd.service: Unit httpd.service not found.

Trying to run letsencrypt from ncp-config to acquire a new certificate
Running letsencrypt
find: ‘/etc/letsencrypt/live/’: No such file or directory
letsencrypt certificates disabled. Using self-signed certificates instead.

Trying to start Apache
sudo service apache2 restart
Job for apache2.service failed because the control process exited with error code.
See “systemctl status apache2.service” and “journalctl -xe” for details.

systemctl status apache2.service
systemctl status apache2.service
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2021-08-19 20:45:20 CEST; 40s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 4906 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

Aug 19 20:45:20 nextcloudpi systemd[1]: Starting The Apache HTTP Server…
Aug 19 20:45:20 nextcloudpi apachectl[4906]: AH00526: Syntax error on line 10 of /etc/apache2/sites-enabled/nextcloud.conf:
Aug 19 20:45:20 nextcloudpi apachectl[4906]: SSLCertificateFile: file ‘/etc/letsencrypt/live/zacans.mooo.com/fullchain.pem’ does not exist or is empty
Aug 19 20:45:20 nextcloudpi apachectl[4906]: Action ‘start’ failed.
Aug 19 20:45:20 nextcloudpi apachectl[4906]: The Apache error log may have more information.
Aug 19 20:45:20 nextcloudpi systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
Aug 19 20:45:20 nextcloudpi systemd[1]: apache2.service: Failed with result ‘exit-code’.
Aug 19 20:45:20 nextcloudpi systemd[1]: Failed to start The Apache HTTP Server.

journalctl -xe
Aug 19 20:45:20 nextcloudpi apachectl[4906]: AH00526: Syntax error on line 10 of /etc/apache2/sites-enabled/nextcloud.conf:
Aug 19 20:45:20 nextcloudpi apachectl[4906]: SSLCertificateFile: file ‘/etc/letsencrypt/live/zacans.mooo.com/fullchain.pem’ does not exist or is empty
Aug 19 20:45:20 nextcloudpi apachectl[4906]: Action ‘start’ failed.
Aug 19 20:45:20 nextcloudpi apachectl[4906]: The Apache error log may have more information.
Aug 19 20:45:20 nextcloudpi systemd[1]: apache2.service: Control process exited, code=exited, status=1/FAILURE
– Subject: Unit process exited

ncp-report

NextCloudPi diagnostics

NextCloudPi version  v1.38.5
NextCloudPi image    NextCloudPi_03-28-20
distribution         Raspbian GNU/Linux 10 \n \l
automount            yes
USB devices          sda
datadir              /media/DonnĂŠes/ncdata
data in SD           no
data filesystem      btrfs
data disk usage      973G/7.3T
rootfs usage         4.1G/29G
swapfile             /var/swap
dbdir                /var/lib/mysql
Nextcloud check      ok
Nextcloud version    20.0.12.1
HTTPD service        down
PHP service          up
MariaDB service      up
Redis service        up
Postfix service      up
internet check       ok
port check 80        closed
port check 443       closed
IP                   ***REMOVED SENSITIVE VALUE***
gateway              ***REMOVED SENSITIVE VALUE***
interface            eth0
certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         no
uptime               2:06

Nextcloud configuration

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": {
            "0": "localhost",
            "5": "nextcloudpi.local",
            "7": "nextcloudpi",
            "8": "nextcloudpi.lan",
            "11": "2a01:e0a:a6c:9460::f452:8b91",
            "1": "192.168.1.3",
            "3": "zacans.mooo.com",
            "2": "zacans.mooo.com",
            "12": "zacans.mooo.com"
        },
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "20.0.12.1",
        "overwrite.cli.url": "https:\/\/zacans.mooo.com\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "tempdirectory": "\/media\/Donn\u00e9es\/ncdata\/tmp",
        "mail_smtpmode": "smtp",
        "mail_smtpauthtype": "LOGIN",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "jpeg_quality": "60",
        "overwriteprotocol": "https",
        "maintenance": false,
        "logfile": "\/media\/Donn\u00e9es\/ncdata\/nextcloud.log",
        "loglevel": "2",
        "log_type": "file",
        "htaccess.RewriteBase": "\/",
        "mail_sendmailmode": "smtp",
        "mail_smtpsecure": "ssl",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "overwritehost": "zacans.mooo.com",
        "preview_libreoffice_path": "\/usr\/bin\/libreoffice",
        "enable_previews": true,
        "enabledPreviewProviders": {
            "0": "OC\\Preview\\TXT",
            "1": "OC\\Preview\\MarkDown",
            "2": "OC\\Preview\\OpenDocument",
            "3": "OC\\Preview\\PDF",
            "4": "OC\\Preview\\MSOffice2003",
            "5": "OC\\Preview\\MSOfficeDoc",
            "6": "OC\\Preview\\PDF",
            "7": "OC\\Preview\\Image",
            "8": "OC\\Preview\\Photoshop",
            "9": "OC\\Preview\\TIFF",
            "10": "OC\\Preview\\SVG",
            "11": "OC\\Preview\\Font",
            "12": "OC\\Preview\\MP3",
            "13": "OC\\Preview\\Movie",
            "15": "OC\\Preview\\MP4",
            "16": "OC\\Preview\\AVI"
        },
        "theme": ""
    }
}

HTTPd logs

[Thu Aug 19 14:06:06.499960 2021] [ssl:emerg] [pid 15230:tid 3069456912] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/nc-error.log for more information
AH00016: Configuration Failed
[Thu Aug 19 18:14:22.452917 2021] [ssl:emerg] [pid 20344:tid 3069305360] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/nc-error.log for more information
AH00016: Configuration Failed
[Thu Aug 19 18:59:44.496571 2021] [ssl:emerg] [pid 1674:tid 3070054928] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/nc-error.log for more information
AH00016: Configuration Failed
[Thu Aug 19 19:13:02.485256 2021] [ssl:emerg] [pid 2009:tid 3069878800] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/nc-error.log for more information
AH00016: Configuration Failed
[Thu Aug 19 19:22:40.468843 2021] [ssl:emerg] [pid 2309:tid 3069633040] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/nc-error.log for more information
AH00016: Configuration Failed
[Thu Aug 19 19:22:40.855945 2021] [ssl:emerg] [pid 2316:tid 3069297168] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/apache2/nc-error.log for more information
AH00016: Configuration Failed

Database logs

2021-08-19 18:51:12 0 [Note] InnoDB: Uses event mutexes
2021-08-19 18:51:12 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-08-19 18:51:12 0 [Note] InnoDB: Number of pools: 1
2021-08-19 18:51:12 0 [Note] InnoDB: Using generic crc32 instructions
2021-08-19 18:51:12 0 [Note] InnoDB: Initializing buffer pool, total size = 1G, instances = 1, chunk size = 128M
2021-08-19 18:51:12 0 [Note] InnoDB: Completed initialization of buffer pool
2021-08-19 18:51:12 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-08-19 18:51:13 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2021-08-19 18:51:13 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-08-19 18:51:13 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-08-19 18:51:13 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-08-19 18:51:13 0 [Note] InnoDB: 10.3.29 started; log sequence number 3786144722; transaction id 15274389
2021-08-19 18:51:13 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-08-19 18:51:13 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-08-19 18:51:13 0 [Note] Server socket created on IP: '127.0.0.1'.
2021-08-19 18:51:13 0 [Note] Reading of all Master_info entries succeeded
2021-08-19 18:51:13 0 [Note] Added new Master_info '' to hash table
2021-08-19 18:51:13 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.3.29-MariaDB-0+deb10u1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Raspbian 10
2021-08-19 18:51:16 0 [Note] InnoDB: Buffer pool(s) load completed at 210819 18:51:16

I’d check if ports are forwarded in router

Yes, I just checked and the ports 80 and 443 are still forwarded to my nextcloudpi in my router configuration.

I’m running same versions of ncp/nc, just ran nc-info on mine, and ports check results are open. So the scripts that checks the ports is working, it has been known to break.

Are you running anything else that might make use of these ports?

Apart from new phone, did anything else change?

What exactly did you do?

Did you manually remove the certificate or the link to it, or edited the nextcloud.conf?

Are you running anything else that might make use of these ports?

No, I didn’t add any service, nothing else is running on these ports.

Apart from new phone, did anything else change?

A few weeks ago, I tried to configure IPV6 access, without success so I reverted the changes. After that Nextcloud was working on my laptop and my old phone, including from outside my local network.

After that I received my new phone, and seeing that it was not working with a “unsecure connection” message, I tried to renew the letsencrypt certificate several times with various commands, then deleting it to obtain a new one, I was then locked because of too many attempts for a few days.

In the meantime I realized Nextcloudpi auto updated and since then HTTPD is down and I can’t start it again.

Did you manually remove the certificate or the link to it, or edited the nextcloud.conf?

Yes I manually removed the certificate. I do not know what is the link to it.
In the nextcloud.conf file I only tried to comment the lines about the certificates as they seem to block the start of HTTPD, but without success so I uncommented them back.

Here is my current nextcloud.conf

DO NOT EDIT! THIS FILE HAS BEEN AUTOMATICALLY GENERATED. CHANGES WILL BE OVERWRITTEN

DocumentRoot /var/www/nextcloud CustomLog /var/log/apache2/nc-access.log combined ErrorLog /var/log/apache2/nc-error.log SSLEngine on SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

<Directory /var/www/nextcloud/>
Options +FollowSymlinks
AllowOverride All

Dav off

LimitRequestBody 0
SSLRenegBufferSize 10486000


Header always set Strict-Transport-Security “max-age=15768000; includeSubDomains”

Sorry, but that is not precise enough to draw conclusions from.

It looks like you reverted to snakeoil cert, from above, but earlier error from letsencrypt asks for a file in /etc/letsencrypt/live/…/…

That file is a symbolic link to the real cert (and key) in /etc/letsencrypte/archive/…/…

You can manually recreate the symbolic links, that is, if the /…/archive/…/… files are still there.

I deleted all old files or certificates, including the directories /archive/ and /live/.
I then recreated the directories.

I deleted the references to the old certificates using these instructions: https://certbot.eff.org/docs/using.html?highlight=dry%20run#deleting-certificates

Then I restarted the RaspberryPi and I now have access again to the Nextcloupi web interface, with the self-signed certificate mentioned in the certbot documentation.
I ran the web wizard for external access until reinstalling the letsencrypt part.

But I now if I try to access Nextcloud, I have the “Apache2 Debian Default Page” displayed. It’s written to replace this file but I do not know by which one. How can I have the Nextcloud homepage back?

NextCloudPi diagnostics

NextCloudPi version  v1.38.5
NextCloudPi image    NextCloudPi_03-28-20
distribution         Raspbian GNU/Linux 10 \n \l
automount            yes
USB devices          sda
datadir              /media/DonnĂŠes/ncdata
data in SD           no
data filesystem      btrfs
data disk usage      972G/7.3T
rootfs usage         4.1G/29G
swapfile             /var/swap
dbdir                /var/lib/mysql
Nextcloud check      ok
Nextcloud version    20.0.12.1
HTTPD service        up
PHP service          up
MariaDB service      up
Redis service        up
Postfix service      up
internet check       ok
port check 80        open
port check 443       open
IP                   ***REMOVED SENSITIVE VALUE***
gateway              ***REMOVED SENSITIVE VALUE***
interface            eth0
certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         no
uptime               33min

Nextcloud configuration

{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": {
            "0": "localhost",
            "5": "nextcloudpi.local",
            "7": "nextcloudpi",
            "8": "nextcloudpi.lan",
            "11": "2a01:e0a:a6c:9460::f452:8b91",
            "1": "192.168.1.3",
            "3": "zacans.mooo.com",
            "2": "zacans.mooo.com",
            "12": "zacans.mooo.com"
        },
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "20.0.12.1",
        "overwrite.cli.url": "https:\/\/zacans.mooo.com\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "tempdirectory": "\/media\/Donn\u00e9es\/ncdata\/tmp",
        "mail_smtpmode": "smtp",
        "mail_smtpauthtype": "LOGIN",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "jpeg_quality": "60",
        "overwriteprotocol": "https",
        "maintenance": false,
        "logfile": "\/media\/Donn\u00e9es\/ncdata\/nextcloud.log",
        "loglevel": "2",
        "log_type": "file",
        "htaccess.RewriteBase": "\/",
        "mail_sendmailmode": "smtp",
        "mail_smtpsecure": "ssl",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpauth": 1,
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "overwritehost": "zacans.mooo.com",
        "preview_libreoffice_path": "\/usr\/bin\/libreoffice",
        "enable_previews": true,
        "enabledPreviewProviders": {
            "0": "OC\\Preview\\TXT",
            "1": "OC\\Preview\\MarkDown",
            "2": "OC\\Preview\\OpenDocument",
            "3": "OC\\Preview\\PDF",
            "4": "OC\\Preview\\MSOffice2003",
            "5": "OC\\Preview\\MSOfficeDoc",
            "6": "OC\\Preview\\PDF",
            "7": "OC\\Preview\\Image",
            "8": "OC\\Preview\\Photoshop",
            "9": "OC\\Preview\\TIFF",
            "10": "OC\\Preview\\SVG",
            "11": "OC\\Preview\\Font",
            "12": "OC\\Preview\\MP3",
            "13": "OC\\Preview\\Movie",
            "15": "OC\\Preview\\MP4",
            "16": "OC\\Preview\\AVI"
        },
        "theme": ""
    }
}

HTTPd logs

[Sat Aug 21 13:37:44.396257 2021] [proxy_fcgi:error] [pid 1001:tid 2584687648] [client 192.168.1.254:51805] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:38:46.399000 2021] [proxy_fcgi:error] [pid 1001:tid 2551116832] [client 192.168.1.254:51807] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:39:48.405771 2021] [proxy_fcgi:error] [pid 1001:tid 2737828896] [client 192.168.1.254:51809] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:40:50.530159 2021] [proxy_fcgi:error] [pid 1002:tid 2576290848] [client 192.168.1.254:51815] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:41:52.501754 2021] [proxy_fcgi:error] [pid 1001:tid 2635043872] [client 192.168.1.254:51818] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:42:54.559389 2021] [proxy_fcgi:error] [pid 1002:tid 2542720032] [client 192.168.1.254:51833] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:43:56.413060 2021] [proxy_fcgi:error] [pid 1001:tid 2601473056] [client 192.168.1.254:51835] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:44:58.444410 2021] [proxy_fcgi:error] [pid 1002:tid 2729436192] [client 192.168.1.254:51836] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:46:00.444704 2021] [proxy_fcgi:error] [pid 1002:tid 2643432480] [client 192.168.1.254:51837] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:47:02.439158 2021] [proxy_fcgi:error] [pid 1002:tid 2609861664] [client 192.168.1.254:51840] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:48:04.432131 2021] [proxy_fcgi:error] [pid 1002:tid 2567898144] [client 192.168.1.254:51844] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:49:06.662096 2021] [proxy_fcgi:error] [pid 1001:tid 2584687648] [client 192.168.1.254:51845] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:50:08.448953 2021] [proxy_fcgi:error] [pid 1001:tid 2551116832] [client 192.168.1.254:51846] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:51:10.436026 2021] [proxy_fcgi:error] [pid 1002:tid 2534327328] [client 192.168.1.254:51847] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:52:12.556947 2021] [proxy_fcgi:error] [pid 1001:tid 2737828896] [client 192.168.1.254:51851] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:53:14.573176 2021] [proxy_fcgi:error] [pid 1002:tid 2718954528] [client 192.168.1.254:51854] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:54:16.493600 2021] [proxy_fcgi:error] [pid 1001:tid 2687497248] [client 192.168.1.254:51857] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:55:18.486048 2021] [proxy_fcgi:error] [pid 1002:tid 2677003296] [client 192.168.1.254:51858] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:56:20.486735 2021] [proxy_fcgi:error] [pid 1001:tid 2635043872] [client 192.168.1.254:51860] AH01071: Got error 'Primary script unknown'
[Sat Aug 21 13:57:22.490247 2021] [proxy_fcgi:error] [pid 1002:tid 2576290848] [client 192.168.1.254:51867] AH01071: Got error 'Primary script unknown'

Database logs

2021-08-21 13:24:50 0 [Note] InnoDB: Uses event mutexes
2021-08-21 13:24:50 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-08-21 13:24:50 0 [Note] InnoDB: Number of pools: 1
2021-08-21 13:24:50 0 [Note] InnoDB: Using generic crc32 instructions
2021-08-21 13:24:50 0 [Note] InnoDB: Initializing buffer pool, total size = 1G, instances = 1, chunk size = 128M
2021-08-21 13:24:50 0 [Note] InnoDB: Completed initialization of buffer pool
2021-08-21 13:24:50 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-08-21 13:24:51 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2021-08-21 13:24:51 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-08-21 13:24:51 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-08-21 13:24:51 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-08-21 13:24:51 0 [Note] InnoDB: 10.3.29 started; log sequence number 3818741642; transaction id 15431918
2021-08-21 13:24:51 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-08-21 13:24:51 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-08-21 13:24:51 0 [Note] Server socket created on IP: '127.0.0.1'.
2021-08-21 13:24:51 0 [Note] Reading of all Master_info entries succeeded
2021-08-21 13:24:51 0 [Note] Added new Master_info '' to hash table
2021-08-21 13:24:51 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '10.3.29-MariaDB-0+deb10u1'  socket: '/run/mysqld/mysqld.sock'  port: 3306  Raspbian 10
2021-08-21 13:24:53 0 [Note] InnoDB: Buffer pool(s) load completed at 210821 13:24:53

Finally I solved my problem by deleting all remaining files and subfolders in
/etc/letsencrypt/archive and /etc/letsencrypt/live and /etc/letsencrypt/renewal
I then obtained a new certificate using sudo certbot certonly
I updated the configuration file with sudo nano /etc/apache2/sites-available/nextcloud.conf

Regarding the access from my phone I found that I did not update my personal local DNS after changing the IP address of my Nextcloud server so it was a mistake from myself and not a Nextcloud issue.

Thank you for your time.