本站支持「有偿」远程协助!

Caddy 下 WordPress 博客

使用 Caddy2 作为 web 服务器, 迁移 WordPress 博客.

安装

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
apt update
apt install php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-imagick -y
apt purge apache2*

mariadb

apt install mariadb-server
mysql_secure_installation
mariadb
create database mainians;
create database routerians;
create database giftians;
create database cmsians;
create database appleians;
create database googleians;
create database teamviewerians;
create database ycycxz;
CREATE USER 'mainians'@localhost IDENTIFIED BY 'mainians';
CREATE USER 'routerians'@localhost IDENTIFIED BY 'routerians';
CREATE USER 'giftians'@localhost IDENTIFIED BY 'giftians';
CREATE USER 'cmsians'@localhost IDENTIFIED BY 'cmsians';
CREATE USER 'appleians'@localhost IDENTIFIED BY 'appleians';
CREATE USER 'googleians'@localhost IDENTIFIED BY 'googleians';
CREATE USER 'teamviewerians'@localhost IDENTIFIED BY 'teamviewerians';
CREATE USER 'ycycxz'@localhost IDENTIFIED BY 'ycycxz';
GRANT ALL PRIVILEGES ON mainians.* TO 'mainians'@localhost;
GRANT ALL PRIVILEGES ON routerians.* TO 'routerians'@localhost;
GRANT ALL PRIVILEGES ON giftians.* TO 'giftians'@localhost;
GRANT ALL PRIVILEGES ON cmsians.* TO 'cmsians'@localhost;
GRANT ALL PRIVILEGES ON appleians.* TO 'appleians'@localhost;
GRANT ALL PRIVILEGES ON googleians.* TO 'googleians'@localhost;
GRANT ALL PRIVILEGES ON teamviewerians.* TO 'teamviewerians'@localhost;
GRANT ALL PRIVILEGES ON ycycxz.* TO 'ycycxz'@localhost;
FLUSH PRIVILEGES;
SHOW GRANTS FOR 'mainians'@localhost;
mariadb -u mainians -p mainians -pmainians < mainians.sql
mariadb -u routerians -p routerians -prouterians < routerians.sql
mariadb -u giftians -p giftians -pgiftians < giftians.sql
mariadb -u cmsians -p cmsians -pcmsians< cmsians.sql
mariadb -u appleians -p appleians -pappleians < appleians.sql
mariadb -u googleians -p googleians -pgoogleians < googleians.sql
mariadb -u teamviewerians -p teamviewerians -pteamviewerians < teamviewerians.sql
mariadb -u ycycxz -p ycycxz -pycycxz < ycycxz.sql

Caddy2

cd /usr/share/caddy
mkdir mainians routerians giftians cmsians appleians googleians teamviewerians ycycxz
mainians.ycycxz.com {
        root * /usr/share/caddy/mainians
        file_server
        php_fastcgi unix//run/php/php8.0-fpm.sock
}

routerians.ycycxz.com {
        root * /usr/share/caddy/routerians
        file_server
        php_fastcgi unix//run/php/php8.0-fpm.sock
}

giftians.ycycxz.com {
        root * /usr/share/caddy/giftians
        file_server
        php_fastcgi unix//run/php/php8.0-fpm.sock
}

cmsians.ycycxz.com {
        root * /usr/share/caddy/cmsians
        file_server
        php_fastcgi unix//run/php/php8.0-fpm.sock
}

appleians.ycycxz.com {
        root * /usr/share/caddy/appleians
        file_server
        php_fastcgi unix//run/php/php8.0-fpm.sock
}

googleians.ycycxz.com {
        root * /usr/share/caddy/googleians
        file_server
        php_fastcgi unix//run/php/php8.0-fpm.sock
}

teamviewerians.ycycxz.com {
        root * /usr/share/caddy/teamviewerians
        file_server
        php_fastcgi unix//run/php/php8.0-fpm.sock
}

ycycxz.com {
        root * /usr/share/caddy/ycycxz
        file_server
        php_fastcgi unix//run/php/php8.0-fpm.sock
}

权限

chown -R www-data:www-data /usr/share/caddy

backup

mysqldump -u root -p -x -A > backup.sql
mysqldump -u mainians -p mainians -pmainians > mainians.sql
mysqldump -u routerians -p routerians -prouterians > routerians.sql
mysqldump -u giftians -p giftians -pgiftians > giftians.sql
mysqldump -u cmsians -p cmsians -pcmsians > cmsians.sql
mysqldump -u appleians -p appleians -pappleians > appleians.sql
mysqldump -u googleians -p googleians -pgoogleians > googleians.sql
mysqldump -u teamviewerians -p teamviewerians -pteamviewerians > teamviewerians.sql
mysqldump -u ycycxz -p ycycxz -pycycxz > ycycxz.sql
zip -r caddy.zip /usr/share/caddy
Loading ...
无广告!