Install Caddy V2 with FreeNAS or FreeBSD

caddy-v2-wordpress-caddyfile

Install Caddy Server Version 2.0 for FreeNAS 11.2 ( might work with 11.1 or newer)

Instruction is only cater for FreeNAS, or FreeBSD. Tested and working on FreeNAS 11.2-U7 and FreeNAS 11.2-U8

Find the Caddy V2 Official Release from here :

#STEP

a) go the your jail
at termainal , type

root@FreeNAS[/]# > jls

it should list out your current running jail

root@turbology[/]# jls
   JID  IP Address      Hostname                      Path
     1                  insidejail                    /mnt/MAIN/iocage/jails/insidejail/root
root@turbology[/]#

b) to enter your jail through therminal
type > jexec tcsh
example , > jexec 1 tcsh

root@FreeNAS[/]# jexec 1 tcsh
root@insidejail:/ #

c) fetch the Caddy program
type > fetch https://github.com/caddyserver/caddy/releases/download/v2.0.0/caddy_2.0.0_freebsd_amd64.tar.gz

root@insidejail:/ # fetch https://github.com/caddyserver/caddy/releases/download/v2.0.0/caddy_2.0.0_freebsd_amd64.tar.gz
caddy_2.0.0_freebsd_amd64.tar.gz                        11 MB  728 kBps    16s
root@insidejail:/ #

d) untar the file
type > tar -xjf caddy_2.0.0_freebsd_amd64.tar.gz

root@insidejail:/ #  tar -xjf caddy_2.0.0_freebsd_amd64.tar.gz
root@insidejail:/ #

e) confirm the caddy version

type > ./caddy version
v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=

root@onlyoffice:/ # ./caddy version
v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
root@onlyoffice:/ #

Note: after the h1: is the version,
it might be vary. but as long as v2.0.0 you are good

f) in case you face file cannot run due to permsion:

type > chmod 744 caddy
change the permision of file, so you can run it.

root@onlyoffice:/ # chmod 744 caddy
root@onlyoffice:/ #

g) copy the file to bin so you can run it anywhere

type > cp caddy /usr/local/bin

For quicker method, you can fetch script to run the above by typing below inside your jail

root@FreeNAS:/ # fetch https://github.com/caddyserver/examples/blob/master/nextcloud/Caddyfile -o installcaddyv2.sh

root@onlyoffice:/ # ./installcaddyv2.sh

or pull a request if you think you can improve it.
default location is /usr/local/www
use text editor if you prefer it at somewhere.

Good Luck and have fun

1 Like