# Self-Signed SSL For Docker Containers for IOS Calendar Integraiton

**URL:** <https://help.nextcloud.com/t/self-signed-ssl-for-docker-containers-for-ios-calendar-integraiton/90241>\
**Category:** 📦 Appliances (Docker, Snappy, VM, NCP, AIO)\
**Created:** [August 21, 2020, 7:52pm UTC](https://help.nextcloud.com/t/self-signed-ssl-for-docker-containers-for-ios-calendar-integraiton/90241 "2020-08-21T19:52:44Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Reiner\_Nippes](https://help.nextcloud.com/user_avatar/help.nextcloud.com/reiner_nippes/32/9479_2.png) [@Reiner\_Nippes](https://help.nextcloud.com/u/Reiner_Nippes)\
**Post date:** [August 22, 2020, 4:48pm UTC](https://help.nextcloud.com/t/self-signed-ssl-for-docker-containers-for-ios-calendar-integraiton/90241/3 "2020-08-22T16:48:24Z")

</div>

> [@mew0717](#):
>
> I’ve tried attaching to the container,

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](https://www.google.com/search?client=firefox-b-d&q=create+self+signed+certificate) 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](https://github.com/nextcloud/vm/blob/748193cb18064af5ad19ecfc2a8ae64348e4b3c7/nextcloud_install_production.sh#L686))
- and you have to expose the port 443 of the nextcloud in the [docker-compose](https://github.com/nextcloud/docker/blob/65f3f6d167defbef27d01819da34314e0569040d/.examples/docker-compose/with-nginx-proxy-self-signed-ssl/mariadb/fpm/docker-compose.yml#L45) 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:

> [@HowTo: Ubuntu + Docker + Nextcloud + Talk + Collabora](https://help.nextcloud.com/t/howto-ubuntu-docker-nextcloud-talk-collabora/76430):
>
> 1.Overview This is a general guide to setting up a functional Nextcloud instance using Ubuntu Server 18.04.3, Docker CE, Docker-Compose, Collabora CODE, and an Apache reverse proxy. By the end (and as of writing), this setup will have an A+ rating on [Nextcloud Security Scan](https://scan.nextcloud.com/) and [Qualys SSL Server Test](https://www.ssllabs.com/ssltest/) and a valid, self-updating certificate from Let’s Encrypt. I will also cover how to update everything. I will do my best to plainly emphasize things that you will need to change, but it will mainly…

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.

---

_[View the full topic](https://help.nextcloud.com/t/self-signed-ssl-for-docker-containers-for-ios-calendar-integraiton/90241)._
