Introduction
WordPress is the most widely used content management system on the internet, powering over 40% of all websites. By installing WordPress on your Raff VM with Nginx, you get a fast, production-ready web hosting platform with full control over your site, plugins, themes, and data.
Nginx serves as the web server in this stack, handling incoming requests with lower memory usage and higher concurrency than Apache. Combined with PHP-FPM for dynamic content processing and MariaDB for database storage, this configuration delivers excellent performance for WordPress sites of all sizes.
In this tutorial, you will install Nginx, PHP-FPM, and MariaDB on Ubuntu 24.04, create a database for WordPress, download and configure WordPress, set up an Nginx server block optimized for WordPress, and complete the browser-based installation. By the end, you will have a fully functional WordPress site ready for content creation.
Step 1 — Install Nginx
Update the package index and install Nginx:
bashsudo apt update
sudo apt install -y nginx
Enable Nginx to start at boot and verify it is running:
bashsudo systemctl enable nginx
sudo systemctl status nginx
You should see active (running) in the output.
Step 2 — Install MariaDB
Install the MariaDB database server:
bashsudo apt install -y mariadb-server
Run the security hardening script:
bashsudo mysql_secure_installation
Follow the prompts: press Enter for the current root password, type n for unix_socket authentication, set a strong root password, and answer Y to all remaining questions to remove anonymous users, disable remote root login, remove the test database, and reload privileges.
Step 3 — Create the WordPress Database
Log into MariaDB and create a database and user for WordPress. Replace strong_password_here with a secure password:
bashsudo mariadb
sqlCREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'strong_password_here';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
The utf8mb4 character set ensures full support for all Unicode characters, including emojis.
Step 4 — Install PHP-FPM and Required Extensions
WordPress requires PHP with several extensions for image processing, database access, and XML parsing. Install PHP-FPM and all required modules:
bashsudo apt install -y php-fpm php-mysql php-curl php-gd php-intl php-mbstring \
php-soap php-xml php-xmlrpc php-zip php-imagick php-common
Verify PHP-FPM is running:
bashsudo systemctl status php8.3-fpm
You should see active (running). PHP-FPM runs as a separate service that Nginx communicates with to process PHP files.
Step 5 — Download and Configure WordPress
Download the latest WordPress release:
bashcd /tmp
curl -O https://wordpress.org/latest.tar.gz
Extract it to the web root:
bashsudo tar -xzf latest.tar.gz -C /var/www/
Set the correct ownership so Nginx (running as www-data) can read and write WordPress files:
bashsudo chown -R www-data:www-data /var/www/wordpress
Create the WordPress configuration file from the sample template:
bashcd /var/www/wordpress
sudo -u www-data cp wp-config-sample.php wp-config.php
Edit the configuration file to add your database credentials:
bashsudo nano /var/www/wordpress/wp-config.php
Find and update these lines with the values you set in Step 3:
phpdefine( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wpuser' );
define( 'DB_PASSWORD', 'strong_password_here' );
define( 'DB_HOST', 'localhost' );
Next, generate unique authentication keys. Visit https://api.wordpress.org/secret-key/1.1/salt/ in your browser to get fresh keys, then replace the placeholder lines in wp-config.php with the generated values.
Save and close the file.
Warning
Never leave the default placeholder keys in a production WordPress installation. Unique keys protect your login cookies and session data.
Step 6 — Configure the Nginx Server Block
Create an Nginx server block optimized for WordPress. Replace your_domain_or_ip with your actual domain name or server IP:
bashsudo nano /etc/nginx/sites-available/wordpress
Add the following configuration:
nginxserver {
listen 80;
listen [::]:80;
server_name your_domain_or_ip;
root /var/www/wordpress;
index index.php index.html;
client_max_body_size 64M;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
log_not_found off;
access_log off;
allow all;
}
location ~* \.(css|gif|ico|jpeg|jpg|js|png|svg|woff|woff2|ttf|eot)$ {
expires 30d;
add_header Cache-Control "public, no-transform";
}
}
Key configuration details:
client_max_body_size 64M— Allows uploading media files up to 64 MBtry_files $uri $uri/ /index.php?$args— Enables WordPress pretty permalinks- The
\.php$block routes PHP requests to PHP-FPM via its Unix socket - Static asset caching (CSS, JS, images) is set to 30 days for performance
Enable the site and disable the default Nginx configuration:
bashsudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
Test the configuration and reload Nginx:
bashsudo nginx -t
sudo systemctl reload nginx
Step 7 — Configure the UFW Firewall
Allow HTTP traffic through the firewall:
bashsudo ufw allow 'Nginx HTTP'
sudo ufw status
Tip
After setting up SSL with Let's Encrypt, switch to Nginx Full to allow both HTTP and HTTPS.
Step 8 — Complete the WordPress Installation
Open your browser and navigate to:
http://your_domain_or_ip
You will see the WordPress installation wizard. Select your language, then fill in:
- Site Title: Your website name
- Username: Choose an admin username (avoid "admin" for security)
- Password: Use a strong, unique password
- Your Email: Your administrator email address
Click Install WordPress. After a few seconds, you will see the success page. Log in with your new credentials to access the WordPress dashboard.
Tip
Your first post-install steps should be: go to Settings > Permalinks and select "Post name" for SEO-friendly URLs, then install a security plugin like Wordfence or Sucuri.
Step 9 — Verify and Optimize
Confirm WordPress is working by visiting your site in a browser. You should see the default WordPress theme with a sample post.
Check PHP processing is working correctly:
bashcurl -I http://your_domain_or_ip
You should see HTTP/1.1 200 OK and headers including X-Powered-By: PHP/8.3.
For production optimization, consider these next steps:
- SSL: Install a free certificate with
sudo apt install certbot python3-certbot-nginxthensudo certbot --nginx -d your_domain - PHP tuning: Increase
memory_limitto 256M andupload_max_filesizeto 64M in/etc/php/8.3/fpm/php.ini - Caching: Install a caching plugin like WP Super Cache or W3 Total Cache
Conclusion
You have installed WordPress on your Raff Ubuntu 24.04 VM with Nginx, PHP-FPM, and MariaDB. Your site is running on a fast, modern web stack optimized for WordPress performance.
From here, you can:
- Secure your site with a free Let's Encrypt SSL certificate
- Install themes and plugins from the WordPress ecosystem
- Configure Raff's automated backup schedule to protect your WordPress data and database
- Add block storage volumes for sites with large media libraries
Raff VMs with NVMe SSD storage and unmetered bandwidth provide the fast I/O and unlimited transfer that WordPress needs for responsive page loads and smooth media uploads. For most WordPress sites with moderate traffic, the 1 vCPU / 2 GB RAM tier ($9.99/month) is an excellent starting point.