Installing Caddy2
Installing PHP
sudo apt update && sudo apt install -y software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.1-fpm php8.1 libapache2-mod-php8.1 php8.1-common php8.1-mysql php8.1-xml php8.1-xmlrpc php8.1-curl php8.1-gd php8.1-imagick php8.1-cli php8.1-imap php8.1-mbstring php8.1-opcache php8.1-soap php8.1-zip php8.1-intl php8.1-bcmath unzip -y
Installing MySQL
sudo apt install mysql-server -y
Downloading WordPress and Extracting
cd /var/www
wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
Configuring
Configuring Caddy
Configuring your Caddyfile which located at /etc/caddy/Caddyfile.
your_website_domain {
root * your_wordpress_directoty
file_server
encode gzip
php_fastcgi unix//run/php/php8.1-fpm.sock
try_files {path} {path}/ /index.php?{query}
}
Restarting Caddy.
sudo service caddy stop
sudo service caddy start
Now, entering your website domain in browser, you’ll see the WordPress setup wizard.
Creating database for WordPress
We should create a database for WordPress.
CREATE DATABASE wordpress;
use wordpress;
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON *.* TO 'username'@'localhost';
flush privileges;
Configuring Caddy
Then, Completing your website by yourself.
Finally, WordPress works.