Reverse Proxy
Installation of Caddy
Sample configuration
In this example, we use Caddy as reverse-proxy in front of Portainer. We start with a fresh Ubuntu 22.04LTS Server.
Installation of Docker and Portainier
- Step 1 : Docker installation
apt install docker docker-compose
- Step 2 : Portainer installation This is a summary of the commands, see the official doc for more informations.
docker pull portainer/portainer-ce
docker volue create portainer_data
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
Installation of Caddy
This is a summary of the commands, see the official doc for more informations.
- Step 1 : Installation
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy
- Step 2 : Configuration of the proxy As portainer is running locally on port 9443, we will configure the reverse proxy to redirect port 8080 to this localport.
The configuration file /etc/caddy/Caddyfile
content will be:
paxcounter.isc.heia-fr.ch:8080 {
reverse_proxy https://localhost:9443 {
transport http {
tls
tls_insecure_skip_verify
}
}
}
- Step 3 : (re) start the Caddy proxy server
service caddy restart
Configuration of portainer
The access to the portainer is now possible through the URL https://paxcounter.isc.heia-fr.ch:8080. Follow the documentation to use this tool.
References
Dernière mise à jour:
3 October 2023