• zitrone 🍋@lemmings.world
      link
      fedilink
      arrow-up
      2
      ·
      2 months ago

      the default systemd service will run caddy as the caddy user i think

      otherwise you can choose any user to run a systemd system service

    • adr1anOPM
      link
      fedilink
      arrow-up
      2
      ·
      2 months ago

      Create a user, and then a systemd unit for it, under ~/.config/systemd/user/ with contents like these:

      [Unit]
      Description=Caddy web server
      After=network.target
      
      [Service]
      ExecStart=/usr/local/bin/caddy run --config /path/to/Caddyfile --envfile /path/to/Envfile
      ExecReload=/usr/local/bin/caddy reload --config /path/to/Caddyfile --envfile /path/to/Envfile
      Restart=on-failure
      User=caddy
      Group=caddy
      
      [Install]
      WantedBy=default.target
      

      Adjust the paths in the arguments. It will require systemctl daemon-reload for such unit to be available for enabling and starting it…