Self-Signed SSL For Docker Containers for IOS Calendar Integraiton

what excatly did you do? docker exec -u www-data nextcloud /bin/sh ?

what you should do:

  • follow one of how-to-create-a-selfsigned-cert listed here: create self signed certificate - Google-haku and store the cert files somewhere on your host filesystem. e.g. /etc/nextcloud
    you may skip this if there are the “snakeoil-cert” file already present in the container. so this would work out of the box.
    SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
    SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key
  • get a working apache config. you can’t just change *80 → *443 because you have to tell apache where to find the cert files. and you have to enable ssl for this virtual host.
    put the new config file also in /etc/nextcloud
  • just now you have to examine the apache config inside of the container.
    docker exec -u www-data nextcloud /bin/sh and search /etc for the apache config. probably you have done that already since you found the 000-default.conf file.
  • putting it together: assuming you used a docker compose file to start the “stack”. you have to bind the files from your host /etc/nextcloud to the according /etc/apache2-file inside the container. on a cli you would have to add e.g.:
    -v /etc/nextcloud/000-default.conf:/etc/apache2/000-default.conf:ro
    -v /etc/nextcloud/selfsigned.key:/etc/ssl/keys/my-selfsigned.key:ro ← and point to /etc/ssl/keys/my-selfsigned.key the vhost *443 section (SSLCertificateKeyFile /etc/ssl/keys/my-selfsigned.key)
  • and you have to expose the port 443 of the nextcloud in the docker-compose file. i guess only port 80 is exposed by default.

you got the idea? “creating a working ssl apache config on your host and bind it into the container.” that’s it.

to get an idea how a working apache ssl vhost config looks like it’s in this article:

if that was already clear to you please post your 000-default.conf and docker-compose file. someone might be able to help you debugging it.