Caddy
Caddy is a free, open-source web server that automatically handles HTTPS certificates and configuration. It’s designed for simplicity and security, making it an excellent choice for both development and production environments.
Preparation
Docker network
First, a Docker network should be created. This means that it is then no longer necessary to publish ports for each individual service. Ports 80 and 443 for the proxy manager are then sufficient, as well as others in certain cases if necessary.
Directory Structure
Caddyfile
Example service
Let’s create a simple web server as an example.
Installation
The web server is already running, but without Caddy it is not accessible. First you have to change back to the caddy directory.
The previously created homepage should now be accessible under homepage.domain.com
erreichbar sein.
Access restriction
An access restriction to certain IP addresses can be done in the Caddyfile.
So only devices from the IP range 192.168.0.0
- 192.168.255.255
are allowed to access the homepage.
Only the ranges 10.0.0.0/8
, 127.0.0.1/8
, 172.16.0.0/12
and 192.168.0.0/16
are allowed.
Update
Update Caddy using Docker Compose: