Được thực hiện trên Debian 12.
ROOT user. Bash shell.
Caddy + MariaDB + PHP 8.3 FPM
apt update && apt upgrade
apt install sudo curl neovim htop unzip fish tmux
apt install mariadb-server
mysql_secure_installation
https://packages.sury.org/php/README.txt
# https://packages.sury.org/php/README.txt
# To add this repository please do:
if [ "$(whoami)" != "root" ]; then
SUDO=sudo
fi
${SUDO} apt-get update
${SUDO} apt-get -y install lsb-release ca-certificates curl
${SUDO} curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
${SUDO} dpkg -i /tmp/debsuryorg-archive-keyring.deb
${SUDO} sh -c 'echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
${SUDO} apt-get update
apt install php7.4 php7.4-apcu php7.4-cli php7.4-curl php7.4-fpm php7.4-intl php7.4-gd php7.4-mbstring php7.4-mysql php7.4-sqlite3 php7.4-xml php7.4-zip
Go
wget https://dl.google.com/go/go1.23.4.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz
# Set up Go environment variables
echo 'export GOROOT=/usr/local/go' >> /etc/profile
echo 'export GOPATH=$HOME/go' >> /etc/profile
echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> /etc/profile
source /etc/profile
go version
Caddy
# Install xcaddy
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
# Install Caddy
xcaddy build \
--with github.com/caddy-dns/cloudflare
# Move Caddy to the system binaries directory
mv caddy /usr/bin
groupadd --system caddy
useradd --system \
--gid caddy \
--create-home \
--home-dir /var/lib/caddy \
--shell /usr/sbin/nologin \
--comment "Caddy web server" \
caddy
usermod -aG www-data caddy
usermod -aG sudo www-data
chmod 1773 /var/lib/php/sessions
vi /etc/systemd/system/caddy.service
Dán
# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.
[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target
[Service]
Type=notify
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --force
TimeoutStopSec=5s
LimitNOFILE=1048576
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
[Install]
WantedBy=multi-user.target
mkdir -p /etc/caddy
echo > /etc/caddy/Caddyfile
systemctl daemon-reload
systemctl enable --now caddy
systemctl status caddy
https://github.com/caddyserver/dist/blob/master/config/Caddyfile
vi /etc/caddy/Caddyfile