Ubuntu 18.04 WordPress Installation: Fast LEMP (Nginx, MySQL, PHP-FPM)
What will you learn in this guide?
In this guide, you will learn how to install WordPress quickly and safely using LEMP architecture on Ubuntu 18.04.
Nginx optimization, PHP-FPM configuration and WordPress security are explained step by step.
🧠 Technical Summary
Main topic: Installing WordPress with LEMP on Ubuntu 18.04
Purpose: To run WordPress on a high-performance and low-resource infrastructure
Steps followed:
- Creating MySQL database and user
- Installing required PHP extensions
- Adapting Nginx server block to WordPress
- Installing WordPress files
- wp-config.php security settings
- Complete the installation from the web interface
🛠 Prerequisites
- Ubuntu 18.04 Cloud Server (Instance)
- Non-root user with sudo authority
- LEMP stack installed (Nginx, MySQL, PHP-FPM)
- Domain name (example:
ornek.com) - SSL configuration
- If there is a domain name: Let's Encrypt
- If it is a test environment: Self-Signed SSL
1️⃣ Creating a MySQL Database for WordPress
WordPress stores all content and user data on MySQL.
1.1 Log in to MySQL administrative account
sudo mysql
- This command opens the MySQL root account.
- Create the WordPress database
CREATE DATABASE genixnode_wp DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
- This database will be used by WordPress.
- Create and authorize custom user
GRANT ALL ON genixnode_wp.* TO 'genix_user'@'localhost' IDENTIFIED BY 'guclu_sifreniz';
- This user only accesses the WordPress database.
- Apply authorizations and exit
FLUSH PRIVILEGES;
EXIT;
- This step activates MySQL settings.
2️⃣ Installing Required PHP Extensions
WordPress and plugins need additional PHP modules.
- Update package list
sudo apt update
- This command refreshes system packages.
- Install PHP extensions
sudo apt install php-curl php-gd php-intl php-mbstring php-soap php-xml php-xmlrpc php-zip
- These packages are required for WordPress functions.
- Restart the PHP-FPM service
sudo systemctl restart php7.2-fpm
- This process activates PHP extensions.
3️⃣ Optimizing Nginx Configuration for WordPress
Nginx is configured to run WordPress with high performance.
- Open the site configuration file
sudo nano /etc/nginx/sites-available/ornek.com
- This file contains Nginx settings for your site.
- Add static file optimization
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;
}
- These settings reduce disk and CPU load.
- Edit WordPress redirect rule
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
- This rule provides the WordPress permalink structure.
- Test configuration and refresh Nginx
sudo nginx -t
sudo systemctl reload nginx
- This step activates the settings.
4️⃣ Downloading and Installing WordPress Files
- Download and extract WordPress
cd /tmp
curl -LO https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
- This command downloads the current version of WordPress.
- Prepare the configuration file
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
- This file contains WordPress settings.
- Move files to web root
sudo cp -a /tmp/wordpress/. /var/www/wordpress
- This process prepares WordPress for publication.
- Set file ownership
sudo chown -R www-data:www-data /var/www/wordpress
- This setting is required for Nginx and PHP-FPM access.
5️⃣ WordPress Security and Configuration Settings
- Generate security keys
curl -s https://api.wordpress.org/secret-key/1.1/salt/
- These keys secure user sessions.
- Open the configuration file
sudo nano /var/www/wordpress/wp-config.php
- Enter database and file system settings
define('DB_NAME', 'genixnode_wp');
define('DB_USER', 'genix_user');
define('DB_PASSWORD', 'guclu_sifreniz');
define('FS_METHOD', 'direct');
- This setting allows updates without asking FTP.
6️⃣ Completing the Setup Via the Web Interface
- From the browser, navigate to your domain or IP address:
https://ornek.com
- Select the language, enter the site information and complete the installation. After installation, you will be directed to the WordPress administration panel.
❓ Frequently Asked Questions (FAQ)
1. Why should Ubuntu 18.04 + LEMP be preferred? It is stable, long supported and offers high performance.
2. Why is Nginx faster than Apache? It consumes less memory and handles concurrent connections well.
3. What does PHP-FPM do? It runs PHP processes more efficiently.
4. Why is FS_METHOD direct? It updates without asking for FTP information.
🎯 Result
With this guide, you have set up a fast, secure and production-ready WordPress infrastructure on Ubuntu 18.04. Nginx, MySQL and PHP-FPM optimized together.
👉 You can create a Cloud Server on the GenixNode platform in seconds and implement this WordPress/LEMP installation immediately.

