Debian 9 WordPress Installation: LEMP (Nginx, MySQL, PHP) Guide
What will you learn in this guide?
In this guide, you will learn how to install WordPress using LEMP architecture on Debian 9 server.
Preparing a MySQL database, installing PHP extensions and configuring Nginx are explained step by step.
🧠 Technical Summary
Main topic: Installing WordPress with LEMP on Debian 9
Purpose: To establish a fast, secure and scalable WordPress infrastructure
Approach:
- Creating MySQL database and users for WordPress
- Installing required PHP extensions
- Optimizing Nginx for WordPress
- Installing WordPress files
- Complete the installation from the web interface
🛠 Prerequisites
- A Cloud Server (Instance) running Debian 9
- Non-root user with sudo authority
- LEMP stack installed (Nginx, MySQL, PHP)
- Domain name (example:
ornek.com) - (Recommended) Let's Encrypt SSL certificate
1️⃣ Creating a MySQL Database for WordPress
WordPress stores all site data on MySQL.
Connect to MySQL administrator account
sudo mysql
- This command logs into the MySQL root account.
- Create database
CREATE DATABASE genixnode_wp DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
- This command creates a custom database for WordPress.
- Create and authorize custom user
GRANT ALL ON genixnode_wp.* TO 'genix_user'@'localhost' IDENTIFIED BY 'guclu_sifreniz';
- This user can only access the WordPress database.
- Apply authorizations and exit
FLUSH PRIVILEGES;
EXIT;
- This step activates MySQL settings.
2️⃣ Installing Required PHP Extensions
WordPress and its plugins need additional PHP modules.
- Update package list
sudo apt update
- This command refreshes the package list.
- 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 PHP-FPM service
sudo systemctl restart php7.0-fpm
- This process activates new PHP extensions.
3️⃣ Optimizing Nginx Configuration
Nginx redirects for WordPress should be edited.
- Open the configuration file for your domain
sudo nano /etc/nginx/sites-available/ornek.com
- This file contains your site's Nginx settings.
- Add cache settings for static files
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 improve performance and reduce logging load.
- Add WordPress redirect setting
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
- This setting ensures that permalinks work properly.
- Test configuration and refresh Nginx
sudo nginx -t
sudo systemctl reload nginx
- This step checks for configuration errors.
4️⃣ 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 is used for WordPress settings.
- Move files to web root
sudo cp -a /tmp/wordpress/. /var/www/ornek.com
sudo chown -R www-data:www-data /var/www/ornek.com
- This process prepares WordPress for publication.
5️⃣ Editing the WordPress Configuration File
- Generate security keys
curl -s https://api.wordpress.org/secret-key/1.1/salt/
- These keys increase WordPress security.
- Open the configuration file
sudo nano /var/www/ornek.com/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
- Navigate to your domain from the browser:
https://ornek.com
- Select the language, enter the site information and complete the installation. You will then be directed to the WordPress administration panel.
❓ Frequently Asked Questions (FAQ)
1. Why use Nginx instead of Apache? Nginx is lighter and faster.
2. What do Salt Keys do? Increases session and cookie security.
3. Why is FS_METHOD set to direct? FTP updates unintentionally.
4. Will it work on Debian 10 or 11? Yes, the steps are largely the same.
5. Is SSL mandatory? Recommended for SEO and security.
🎯 Result
With this guide, you have established a LEMP-based, optimized and secure WordPress infrastructure on Debian 9. Nginx performance, MySQL layout and PHP compatibility were achieved together.
👉 You can create a Cloud Server on the GenixNode platform in minutes and implement this WordPress installation immediately.

