How to Install WordPress with LEMP Stack on Debian 13

WordPress is a web content management system. It was originally created as a tool to publish blogs but has evolved to support publishing other web content, including more traditional websites, mailing lists and Internet forum, media galleries, membership sites, learning management systems and online stores.

Prerequisites

Create WordPress Database

mysql -u root -p

Inside MariaDB prompt:

CREATE DATABASE wordpress;
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'strongpassword';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wp_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Install PHP and Extensions

apt install php-fpm php-mysql php-cli php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip -y

Check PHP version:

php -v

Download and Configure WordPress

cd /tmp
apt update && apt install -y curl
curl -O https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz

Copy WordPress files to web root:

cp -r wordpress/* /var/www/html/

Set permissions:

chown -R www-data:www-data /var/www/html/
find /var/www/html/ -type d -exec chmod 755 {} \;
find /var/www/html/ -type f -exec chmod 644 {} \;

Configure WordPress

cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php
nano /var/www/html/wp-config.php

Edit the DB config:

define('DB_NAME', 'wordpress');
define('DB_USER', 'wp_user');
define('DB_PASSWORD', 'strongpassword');
define('DB_HOST', 'localhost');

Configure Nginx for WordPress

nano /etc/nginx/sites-available/wordpress

Paste:

server {
    listen 80;
    server_name your_server_ip;

    root /var/www/html;
    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:/run/php/php-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

Enable the config:

ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/
rm /etc/nginx/sites-enabled/default
nginx -t
systemctl reload nginx

Finish Installation in Browser

Open browser and go to:

http://<your_server_ip>/

Follow WordPress setup wizard.

images

images

images

images

images

Conclusion

You now have WordPress running on a LEMP stack on Debian 13 (Trixie). Enjoy building your website or blog!


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS