Được thực hiện trên Debian 12.
ROOT user. Bash shell.
Caddy + MariaDB + PHP 8.3 FPM
01.apt update && apt upgrade
01.apt install sudo curl neovim htop unzip fish tmux
01.apt install mariadb-server02.mysql_secure_installation
01.# https://packages.sury.org/php/README.txt02. 03.# To add this repository please do:04. 05.if [ "$(whoami)" != "root" ]; then06. SUDO=sudo07.fi08. 09.${SUDO} apt-get update10.${SUDO} apt-get -y install lsb-release ca-certificates curl11.${SUDO} curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb12.${SUDO} dpkg -i /tmp/debsuryorg-archive-keyring.deb13.${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'14.${SUDO} apt-get update
01.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
Caddy
01.# Install xcaddy02.go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest03. 04.# Install Caddy05.xcaddy build 06. --with github.com/caddy-dns/cloudflare07. 08.# Move Caddy to the system binaries directory09.mv caddy /usr/bin
01.groupadd --system caddy02.useradd --system 03. --gid caddy 04. --create-home 05. --home-dir /var/lib/caddy 06. --shell /usr/sbin/nologin 07. --comment "Caddy web server" 08. caddy09.usermod -aG www-data caddy10.usermod -aG sudo www-data11.chmod 1773 /var/lib/php/sessions
01.vi /etc/systemd/system/caddy.service
Dán
01.# caddy.service02.#03.# For using Caddy with a config file.04.#05.# Make sure the ExecStart and ExecReload commands are correct06.# for your installation.07.#08.# See https://caddyserver.com/docs/install for instructions.09.#10.# WARNING: This service does not use the --resume flag, so if you11.# use the API to make changes, they will be overwritten by the12.# Caddyfile next time the service is restarted. If you intend to13.# use Caddy's API to configure it, add the --resume flag to the14.# `caddy run` command or use the caddy-api.service file instead.15. 16.[Unit]17.Description=Caddy18.Documentation=https://caddyserver.com/docs/19.After=network.target network-online.target20.Requires=network-online.target21. 22.[Service]23.Type=notify24.User=caddy25.Group=caddy26.ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile27.ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile --force28.TimeoutStopSec=5s29.LimitNOFILE=104857630.PrivateTmp=true31.ProtectSystem=full32.AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE33. 34.[Install]35.WantedBy=multi-user.target
01.mkdir -p /etc/caddy02.echo > /etc/caddy/Caddyfile03. 04.systemctl daemon-reload05.systemctl enable --now caddy06.systemctl status caddy
https://github.com/caddyserver/dist/blob/master/config/Caddyfile
01.vi /etc/caddy/Caddyfile