FreeBSD is nice and all, but editing files on it sucks (and i want to keep my firewall kinda clean) so lets get Mutagen up and running first
mkdir caddy
cd caddy
mutagen sync create --name Caddy . root@10.0.0.254:~/caddy/( when you are done with this, feel free to delete it using mutagen sync terminate Caddy)
Download caddy for FreeBSD from caddyserver.com and put it in the caddy folder we created
Configuring caddy is easy peasy lemon squezy! here is an example
{
debug
## If you want to use sslh to map forwards, change the ssl port
# https_port 4431
}
host1.proudlySelfHosted.tld {
reverse_proxy 10.0.0.1:8080 {
# Extra config goes here
}
}
# This host has SSL but its crappy so fix it
host2.alsoSelfHosted.tld {
reverse_proxy 10.0.0.1:443 {
transport http {
tls_insecure_skip_verify
}
}
}put this into the caddy folder to
here is a quick script to get caddy into the service system of FreeBSD
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: caddy
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add these lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# caddy_enable (bool): Set to YES by default.
# Set it to NO to disable caddy.
# caddy_config (path): Set to /root/caddy/Caddyfile
# by default.
. /etc/rc.subr
name=caddy
rcvar=caddy_enable
load_rc_config $name
: ${caddy_enable:="YES"}
: ${caddy_config="/root/caddy/Caddyfile"}
command="/root/caddy/caddy"
command_args="start --config ${caddy_config}"
run_rc_command "$1"now SSH to your box (hit 8 for terminal) and run caddy start --config /root/caddy/Caddyfile to test it :-)
if all is fine (which it should be) run
service enable caddy && service start caddy
Done and done! Marry X-Mas!