Support Online
Skip to main content

Installing WordPress with LEMP on Ubuntu 16.04

Keyword: Ubuntu LEMP WordPress installation

What Will You Learn in This Guide?

In this guide, you will learn how to install WordPress using LEMP architecture on Ubuntu 16.04 server.
Nginx optimization, secure file permissions and SEO friendly configuration are covered.
At the end of the installation, the WordPress administration panel will be ready for use.

Technical Summary

  • Technical Topic: Installing WordPress with LEMP on Ubuntu 16.04
  • Solved Problem: Running WordPress quickly and securely on Nginx
  • Steps Followed:
    1. Creating MySQL database and user
    2. Adapting Nginx configuration to WordPress
    3. Installing PHP extensions
    4. Download WordPress files
    5. Set file permissions
    6. Complete the installation via web interface

1. MySQL Database Preparation for WordPress

WordPress stores all content and user data on MySQL.
First log in with the MySQL administrator account.

mysql -u root -p
  • This command opens the MySQL management console.


CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON wordpress.* TO 'wp_kullanicisi'@'localhost' IDENTIFIED BY 'guclu_sifre';
FLUSH PRIVILEGES;
EXIT;
  • Creates custom database and user for WordPress.

2. Making Nginx Configuration Compatible with WordPress

  1. Nginx needs to handle WordPress permalinks correctly.

sudo nano /etc/nginx/sites-available/default
  • Opens the default Nginx site configuration file.


location / {
try_files $uri $uri/ /index.php$is_args$args;
}
  • Ensures SEO compatible WordPress links work.


sudo nginx -t
sudo systemctl reload nginx
  • Tests the configuration and reloads Nginx.

3. Installation of Required PHP Plugins

  1. WordPress and plugins need additional PHP modules.

sudo apt-get update
sudo apt-get install php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc
  • Installs common PHP plugins for WordPress.


sudo systemctl restart php7.0-fpm
  • Restarts the PHP processor.

4. Downloading WordPress Files


cd /tmp
curl -O https://wordpress.org/latest.tar.gz
tar xzvf latest.tar.gz
  • Downloads the current WordPress version.


cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
sudo cp -a /tmp/wordpress/. /var/www/html
  • Moves WordPress files to the web directory.

5. File Permissions and Security Settings

  1. Secure and sustainable permits are defined.

sudo chown -R tr1-node01:www-data /var/www/html
  • Shares file ownership between the user and the web server.


sudo find /var/www/html -type d -exec chmod g+s {} \;
sudo chmod g+w /var/www/html/wp-content
  • Provides secure write permission for theme and plugin updates.

6. Editing the WordPress Configuration File


nano /var/www/html/wp-config.php
  • Opens the WordPress main configuration file.


define('DB_NAME', 'wordpress');
define('DB_USER', 'wp_kullanicisi');
define('DB_PASSWORD', 'guclu_sifre');
define('FS_METHOD', 'direct');
  • Defines the database connection and file writing method.

7. Completing the Setup from the Web Interface

  1. From the browser, go to the following address:

http://sunucu_ip_adresi
  1. Select your language

  2. Enter site title and admin information

  3. Click the Install WordPress button


Frequently Asked Questions (FAQ)

1. Why do WordPress updates fail? File permissions should be temporarily expanded during the update.

2. I am getting Nginx 404 error, what is the solution? Check that the try_files line is configured correctly.

3. Is an SSL certificate required? Yes. Let's Encrypt is recommended for live sites.

4. Am I getting a database connection error? The information in wp-config.php must be identical to MySQL.


Result

WordPress installation has been completed successfully. You can now choose themes and configure permalinks.

🚀 You can publish this structure within minutes on the GenixNode infrastructure. You are ready for fast, safe and SEO-friendly projects.