#!/bin/bash

chmod +x /usr/bin/caddy

groupadd --system caddy

useradd --system \
   --gid caddy \
   --create-home \
   --home-dir /var/lib/caddy \
   --shell /usr/sbin/nologin \
   --comment "Caddy web server" \
   caddy

cp caddy.service /etc/systemd/system/

mkdir /etc/caddy
mkdir /var/www

cp Caddyfile /etc/caddy/

systemctl daemon-reload
systemctl enable caddy
systemctl start caddy
systemctl status caddy

ufw allow proto tcp from 10.25.0.0/24 port 80