How to Install WordPress on Rocky Linux 10 with LEMP Stack
WordPress is a powerful Content Management System (CMS) that enables users to build and manage websites with ease. In this guide, we'll walk through installing WordPress on Rocky Linux 10 with the LEMP stack (Linux, Nginx, MariaDB, PHP).
Prerequisites
Ensure the LEMP stack is installed and running:
- Nginx
- MariaDB
- PHP 8.4 (from Remi’s repo)
Click here to view the guide on How to Install LEMP Stack on Rocky Linux 10
Create the WordPress Database
mysql -u root -p
Then run:
CREATE DATABASE wordpress;
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'Strongpassword@123';
GRANT ALL PRIVILEGES ON wordpress.* TO 'admin'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Install Required PHP Extensions
dnf install php-mysqlnd
Restart services:
systemctl restart php-fpm
systemctl restart nginx
Configure Nginx
mkdir -p /var/www/html/example.com/public_html
vi /etc/nginx/conf.d/example.com.conf
Paste:
server {
listen 80;
listen [::]:80;
server_name example.com www.example.com;
root /var/www/html/example.com/public_html;
index index.html;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ =404;
}
location ~* \.php$ {
fastcgi_pass unix:/run/php-fpm/www.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}
}
Test and reload:
nginx -t
systemctl restart nginx
Download and Extract WordPress
cd /tmp
curl -L -O http://wordpress.org/latest.tar.gz
dnf install -y tar
tar xf latest.tar.gz
mv wordpress/* /var/www/html/example.com/public_html/
Configure WordPress
cd /var/www/html/example.com/public_html/
cp wp-config-sample.php wp-config.php
vi wp-config.php
Update:
define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'admin' );
define( 'DB_PASSWORD', 'Strongpassword@123' );
define( 'DB_HOST', 'localhost' );
Set Permissions
chown -R nginx:nginx /var/www/html/example.com/public_html
chcon -R -t httpd_sys_content_t /var/www/html/example.com/public_html
Finalize WordPress Setup
Open in browser:
http://your_server_ip/ or http://example.com/
Click "Run the installation" and follow setup steps.




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