I have successfully installed and am running Nextcloud in docker. The installation uses LetsEncrypt to generate the certificates and runs without problems when I access it using HTTP.
When I attempt to use HTTPS, however, I am getting 500 Internal Server Error.
Researching this problem, I have learned that by default the nginx proxy container is not actually configured to use HTTPS (based on various nextcloud descriptions I have read online). Apparently what has to be done is to configure it to be able to use SSL.
Trouble is, there is no step by step procedure given for doing this.
Just about everywhere I look I am finding plenty of tutorials and instructions that include “set up letsencrypt” or "place certs in using certbot or other methods. This is nice but the docker-compose.yml file I used already sets up the certs! What I need is some clear instructions on how to configure the nginx-proxy to use SSL. I have been unable to find such instructions.
Can someone tell me how to properly configure the nginx-proxy container to use SSL? Or failing that, can someone point me to some clear instructions for properly configuring it for SSL?
2
Answers
While the answer above given y Alexandre is a good one (I gave it a point for the effort and it does work), I ended up solving my problem by writing my own reverse proxy server. This server is specifically designed for Nextcloud and runs well in a Docker container. It requires little configuration and is easier to set up and use than an nginx proxy. It works with SSL and acts as a good security layer in from of Nextclud.
Reverse proxies are easy to make using various frameworks. Once I decided to go that route it took less than three hours to make this one for Nextcloud.
If there is interest I will be happy to share the code and container.
I personnaly use the https://github.com/nginx-proxy/nginx-proxy container to do that.
Here is the command I use to start my reverse-proxy container :
The line bellow set up the container in the same network than other containers.
The line bellow tells the proxy where it can find certs of your domains.
You have to put your certs in that folder, to generate a certificate you can use https://certbot.eff.org/. The certs have to be named like this : example.com.key for the private key and example.com.crt for the cert.
If you need help : https://github.com/nginx-proxy/nginx-proxy and https://certbot.eff.org/
The line bellow permit communication between containers, so that the proxy will be able to redirect requests.
After that you have to set up the VIRTUAL_HOST environement variable in others containers to tell the domain name of the others containers to the reverse-proxy.
An exemple of a webserver container :