WordPress powers over 40% of all websites. Installing it on a LEMP stack (Nginx + MySQL + PHP-FPM) gives you superior performance compared to the traditional LAMP/Apache setup. This guide installs WordPress on Ubuntu 26.04 LTS with Nginx, PHP 8.4, and MySQL 9.

Tested and valid on:

  • Ubuntu 26.04 LTS

Prerequisites

  • Ubuntu 26.04 LTS with Nginx, PHP 8.4-FPM, and MySQL 9
  • A domain name pointed to your server
  • UFW with ports 80 and 443 open

Step 1 – Create a MySQL Database for WordPress

sudo mysql
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'WPpass2026!';
GRANT ALL ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
exit

Step 2 – Download and Extract WordPress

cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzf latest.tar.gz
sudo mv wordpress /var/www/example.com
sudo chown -R www-data:www-data /var/www/example.com

Step 3 – Configure WordPress

sudo cp /var/www/example.com/wp-config-sample.php /var/www/example.com/wp-config.php
sudo nano /var/www/example.com/wp-config.php

Set your database credentials:

define('DB_NAME', 'wordpress');
define('DB_USER', 'wpuser');
define('DB_PASSWORD', 'WPpass2026!');

Step 4 – Create the Nginx Config

sudo nano /etc/nginx/sites-available/example.com

Add a WordPress-optimised server block:

server {
    listen 80;
    server_name example.com www.example.com;
    root /var/www/example.com;
    index index.php;
    location / { try_files $uri $uri/ /index.php?$args; }
    location ~ .php$ {
        fastcgi_pass unix:/run/php/php8.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
    location ~ /.ht { deny all; }
}
sudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx

Step 5 – Complete the WordPress Installation

Visit http://example.com and follow the 5-minute setup wizard: enter site name, admin username, password, and email.

Step 6 – Add SSL with Certbot

sudo certbot --nginx -d example.com -d www.example.com

Step 7 – Set File Permissions

sudo find /var/www/example.com -type d -exec chmod 755 {} ;
sudo find /var/www/example.com -type f -exec chmod 644 {} ;

Conclusion

WordPress is now running on Ubuntu 26.04 LTS with Nginx and PHP 8.4. Install a caching plugin like W3 Total Cache or WP Rocket to maximise performance, and keep WordPress, themes, and plugins updated regularly.