How to Manually Install WordPress on Debian 12

Step 1: SSH into the Debian system
ssh root@servername
Step 2: Install nginx, mariadb, and php
1. First update the sources:
apt-get update
apt-get upgrade
2. Install nginx:
apt install nginx
systemctl start nginx
systemctl enable nginx
apt install mariadb-server
3. Install PHP and its additional components:
apt install php php-mysql php-gd php-xml php-mbstring php-curl php-fpm php-mysql php-imagick php-zip php-intl
Step 3: Configure the MariaDB database
1. Log in to the database; MariaDB's initial root password is empty:
mysql -u root -p
2. Create the default database:
CREATE DATABASE [wordpressdatabasename];
3. Create a WordPress database account:
CREATE USER '[wordpressuser]'@localhost IDENTIFIED BY 'wordpresspassword';
4. Grant permissions on the database:
GRANT ALL PRIVILEGES ON [wordpressdatabasename].* TO [wordpressuser]@localhost IDENTIFIED BY 'wordpresspassword';
FLUSH PRIVILEGES;
EXIT;
Step 4: Configure the nginx service
1. Create and modify the WordPress configuration file in nginx:
nano /etc/nginx/sites-available/wordpress
The configuration file looks like this:
server {
listen 80;
server_name www.yourdomain.com yourdomain.com;
root /var/www/wordpress;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ .php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /.ht {
deny all;
}
2. Edit the nginx global configuration file:
nano /etc/nginx/nginx.conf
Modify the http{} block
Add:
client_max_body_size 20m;
3. Link the WordPress configuration file into the site configuration folder:
ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/
4. Test whether the configuration is correct:
nginx -t
systemctl restart nginx
Step 5: Configure PHP
Edit the PHP configuration file:
nano /etc/php/8.2/fpm/php.ini
Modify the following parameters:
max_execution_time = 1200
max_input_time = 1200
upload_max_filesize = 200M
post_max_size = 800m
Restart the PHP service:
service php8.2-fpm restart
Step 6: Download and install WordPress
cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
cp -a /tmp/wordpress/. /var/www/wordpress
chown -R www-data:www-data /var/www/wordpress