I'm trying to setup Nextcloud on a AWS EC2 instance, and it all seems to work fine, except for 1 thing.
I've renamed the server from the original name to the proper domain:
ubuntu@nextcloud:/var/log/apache2# cat /etc/hostname
nextcloud.xxx-aws.com
The config in nextcloud-le-ssl.conf does reflect the correct domain name
ubuntu@nextcloud:/var/log/apache2# cat /etc/apache2/sites-enabled/nextcloud-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
DocumentRoot /var/www/nextcloud/
ServerName nextcloud.xxx-aws.com
ServerAlias nextcloud.xxx-aws.link
<Directory /var/www/nextcloud/>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>
</Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/nextcloud.xxx-aws.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/nextcloud.xxx-aws.com/privkey.pem
</VirtualHost>
</IfModule>
But when I start apache, I have this message in the error log, and think this might make the application crash every now and then.
ubuntu@nextcloud:/var/log/apache2# tail -f error.log
[Wed Jan 24 06:40:42.392510 2024] [ssl:warn] [pid 459] AH01909: ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com:443:0 server certificate does NOT include an ID which matches the server name
The certificates are generated with Certbot.
I'm not sure what I'm doing wrong here.
I'm not fully sure how to resolve this issue.
Adding the hostname to localhost in /etc/hosts and renew the certificates seemed to have resolved the issue.