Installing WordPress with LEMP on Ubuntu 22.04
📘 What Will You Learn in This Guide?
In this guide, you will install WordPress with LEMP architecture on Ubuntu 22.04.
You will get higher performance by using Nginx instead of Apache.
The installation will be completed in accordance with the production environment.
🧠 Technical Summary
This guide explains how to install WordPress on Ubuntu 22.04.
The goal is to create a fast and secure infrastructure with the LEMP stack.
The steps cover MySQL, PHP, Nginx and WordPress configuration.
Preliminary Preparations
Before starting the installation, the following must be ready:
- Server with Ubuntu 22.04 installed
- sudo authorized user
- Installed LEMP stack
- Domain name or server IP address
- SSL certificate (Let's Encrypt recommended)
1. Creating a MySQL Database for WordPress
- Log in to the MySQL admin panel:
sudo mysql
- This command opens the MySQL command line.
CREATE DATABASE genixnode_wp DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
- This command creates the WordPress database.
CREATE USER 'wp_kullanici'@'localhost' IDENTIFIED BY 'guclu_sifre';
GRANT ALL ON genixnode_wp.* TO 'wp_kullanici'@'localhost';
FLUSH PRIVILEGES;
EXIT;
- This user only accesses the WordPress database.
2. Installing Required PHP Extensions
- WordPress requires additional PHP modules.
sudo apt update
sudo apt install php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip
- This command installs WordPress compatible PHP plugins.
sudo systemctl restart php8.1-fpm
- This command restarts PHP services.
3. Nginx Configuration
- Edit the Nginx server block for WordPress:
sudo nano /etc/nginx/sites-available/wordpress
- This file contains the site configuration.
server {
listen 80;
server_name siteadresiniz.com www.siteadresiniz.com;
root /var/www/wordpress;
index index.php index.html;
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)$ {
expires max;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
}
}
- This configuration enables PHP and permalinks.
sudo nginx -t
sudo systemctl reload nginx
- These commands verify and apply the configuration.
4. Downloading WordPress Files
- Download WordPress from the official source:
cd /tmp
curl -LO https://wordpress.org/latest.tar.gz
- This command downloads the latest version.
tar xzvf latest.tar.gz
- This command unpacks the archive.
sudo cp -a /tmp/wordpress/. /var/www/wordpress
sudo chown -R www-data:www-data /var/www/wordpress
- This script moves the files to the web directory and sets permissions.
5. WordPress Configuration
- Generate secure keys:
curl -s https://api.wordpress.org/secret-key/1.1/salt/
- This command generates WordPress security keys.
sudo nano /var/www/wordpress/wp-config.php
- Add database settings:
define('DB_NAME', 'genixnode_wp');
define('DB_USER', 'wp_kullanici');
define('DB_PASSWORD', 'guclu_sifre');
define('FS_METHOD', 'direct');
- These settings ensure operation without FTP problems.
6. Completing the Setup from the Web Interface
- From the browser, go to:
http://siteadresiniz.com
- Select language and enter administrator information.
- When the installation is completed, you will be directed to the panel.
❓ Frequently Asked Questions (FAQ)
1. Why is Nginx preferred? It consumes less resources and is stable in high traffic.
2. FTP information is asked, why? FS_METHOD setting may not be set.
3. Is SSL mandatory? Highly recommended for live sites.
4. Is this structure sufficient for a single site? Yes, it is ideal for a single WordPress site.
🚀 Result
LEMP architecture is fast and secure for WordPress. Correct configuration provides performance in the long run.
👉 You can implement this installation within minutes on the GenixNode infrastructure.

