From 85f0e23a9cde61af371b421720750eb64d8b3ea0 Mon Sep 17 00:00:00 2001 From: Yik Teng Hie Date: Tue, 27 Sep 2022 12:08:18 +0800 Subject: [PATCH] add caddy setup 64bit --- caddysetup.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++ swapfile.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 caddysetup.md create mode 100644 swapfile.md diff --git a/caddysetup.md b/caddysetup.md new file mode 100644 index 0000000..aae7741 --- /dev/null +++ b/caddysetup.md @@ -0,0 +1,57 @@ +https://pimylifeup.com/raspberry-pi-caddy-web-server/ + +``` +sudo apt update +sudo apt upgrade +``` + +``` +sudo apt remove apache2 +``` + +``` +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 +``` + +``` +$ wget https://github.com/caddyserver/caddy/releases/download/v2.6.1/caddy_2.6.1_linux_arm64.tar.gz -O caddy.tar.gz + +$ mkdir caddy && tar -zxvf caddy.tar.gz -C caddy + +$ cd caddy +$ mv caddy_linux_arm7 caddy +``` + +``` +sudo mkdir /etc/caddy + +sudo nano /etc/caddy/Caddyfile +``` + +``` +$ sudo setcap CAP_NET_BIND_SERVICE=+eip ./caddy +``` + +install/update acme client + +``` +$ sudo apt-get install certbot +``` + +to check acme version + +install the script + +``` +$ curl https://get.acme.sh | sh +``` + +!!!! run service + +``` +$ sudo ./caddy run --config Caddyfile +``` \ No newline at end of file diff --git a/swapfile.md b/swapfile.md new file mode 100644 index 0000000..9ea1a68 --- /dev/null +++ b/swapfile.md @@ -0,0 +1,52 @@ +# Change swap file size + +https://cloudolife.com/2021/01/01/Raspberry-Pi/Resizing-or-disable-Swap-Size/#:~:text=Raspberry%20Pi%20Swap%20Size,-Users%20who%20stake&text=However%20in%20most%20cases%20Raspbian,size%20should%20be%20100%20MB.&text=%23%20Generally%2C%20when%20the%20memory%20is,should%20be%20twice%20the%20memory. + +``` +$ free -m + total used free shared buff/cache available +Mem: 924 287 107 23 530 652 +Swap: 100 1 99 +``` + +``` +$ nano /etc/dphys-swapfile +``` + +``` +# /etc/dphys-swapfile - user settings for dphys-swapfile package +# author Neil Franklin, last modification 2010.05.05 +# copyright ETH Zuerich Physics Departement +# use under either modified/non-advertising BSD or GPL license + +# this file is sourced with . so full normal sh syntax applies + +# the default settings are added as commented out CONF_*=* lines + + +# where we want the swapfile to be, this is the default +#CONF_SWAPFILE=/var/swap + +# set size to absolute value, leaving empty (default) then uses computed value +# you most likely don't want this, unless you have an special disk situation +# CONF_SWAPSIZE=100 + +# Generally, when the memory is less than 2G, the swap partition should be twice the memory. +CONF_SWAPSIZE=2048 + +# set size to computed value, this times RAM size, dynamically adapts, +# guarantees that there is enough swap without wasting disk space on excess +#CONF_SWAPFACTOR=2 + +# restrict size (computed and absolute!) to maximally this limit +# can be set to empty for no limit, but beware of filled partitions! +# this is/was a (outdated?) 32bit kernel limit (in MBytes), do not overrun it +# but is also sensible on 64bit to prevent filling /var or even / partition +#CONF_MAXSWAP=2048 +``` + +``` +sudo /etc/init.d/dphys-swapfile restart +[....] Restarting dphys-swapfile (via systemctl): dphys-swapfile.service + +``` \ No newline at end of file