1. The problem I’m having:
I am not familiar with network set ups and don’t really know where to start!
As you can see from the Caddyfile I have tried a few things but not really understanding what I am doing!
This is what I have so far:
- I have registered a domain
-
pifei.co.uk -
``` with my hosting provider (Hostinger) - I have a duckdns account and registered
- `
``pifei.duckdns.org```
This is what I am trying to achieve:
I have a few raspberry pies. I would like to use one (pifei) as a central contact where I could direct traffic to the other pies (let’s call them ‘photos’, ‘indoor’ and ‘garden’) on the network They would all be subdomains of pifei.co.uk. The three pies would not need to see each other, but would all need to be accesssible from the outside world AND be https!!
I have managed to open ports 80 and 443 and point -
photos.pifei.co.uk -
``` to it, but then I am stuck because no other subdomain can use these ports AND that is where I would need caddy to come to the rescue!! Hope this is clear and someone can help in plain, simple terms.
2. Error messages and/or full log output:
PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.
3. Caddy version:
4. How I installed and ran Caddy:
Installed with the help of
```
cd ~
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo tee /etc/apt/trusted.gpg.d/caddy-stable.asc
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
```
a. System environment:
Raspberry pi model b plus
Raspbian Trixie
Debian version full 13.1
b. Command:
```sudo nano /etc/caddy/Caddyfile
```
c. Service/unit/compose file:
PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.
d. My complete Caddy config:
```
# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.
#:80 {
# Set this path to your site's directory.
# root * /usr/share/caddy
# Enable the static file server.
# file_server
# Another common task is to set up a reverse proxy:
# reverse_proxy localhost:8080
# Or serve a PHP site through php-fpm:
# php_fastcgi localhost:9000
#}
:80 {
redir * https://{host}{uri} 301
}
photorpi.duckdns.org {
respond * "This is photo pi" 200 {
close
}
#handle_path /* {
#reverse_proxy https://photos.feichter.co.uk
# reverse_proxy 192.168.1.139
#}
#redir http://photos.feichter.co.uk
#reverse_proxy 192.168.1.139
}
indoor.pifei.co.uk {
respond * "This is indoor pi" 200 {
close
}
#redir https://indoorpi.feichter.co.uk
#reverse_proxy 192.168.1.246:443
}
:443 {
respond * "Access denied" 403 {
close
}
}
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile
```
PASTE OVER THIS, BETWEEN THE ``` LINES.
Please use the preview pane to ensure it looks nice.


