Adding a reverse proxy to Nextcloud
If you followed part one of this tutorial (it’s on the archive, https://linuxformat.com/archives, available to all) you should have a working install of Nextcloud running in a Docker container, along with a supporting container running MariaDB. Assuming you configured port forwarding entries on your router, you should also be able to access this Nextcloud server from outside your home network. This is great, but one of the main advantages of using Docker is that it’s really easy to add extra containers; however, only one of these can listen on a given TCP port (such as TCP/443, for secure web connections).
One solution is to configure port forwarding entries for each container (such as TCP/443 for Nextcloud, TCP/444 for a wiki, etc.). This approach has a number of problems, not least that some locations might block your access to non-standard web ports; many corporate or educational networks limit access to TCP/80 and TCP/443, for example.
Another way to solve the problem is to use a reverse proxy, which is a service that listens for web requests
(e.g. TCP/80 or TCP/443), and then retrieve the requested content from Nextcloud, wiki or similar. Reverse proxies have been around for a long time, and the two most popular web servers (Apache and Nginx) can both work this way. For this), which is an open source edge router; it offers both traditional reverse-proxy services, along with many other features. Among its many impressive features, Traefik is Docker-aware (as well as many other container platforms), meaning that it can discover containers automatically, and you can configure it using the same docker-compose tool we used in part 1 of the tutorial.
You’re reading a preview, subscribe to read more.
Start your free 30 days