How To Install WordPress on the LEMP(Nginx) Stack?

Introduction:

WordPress is a popular content management system (CMS) used by millions of websites worldwide. In this guide, we’ll cover the steps to install and configure WordPress on the LEMP stack (Linux, Nginx, MySQL, PHP) on Ubuntu 22.04 LTS.

Step 1: Prepare Your LEMP Stack Environment

  • Ensure your LEMP stack is set up and running smoothly as per the previous blog’s (LEMP Stack) instructions.
  • Confirm that Nginx, MySQL, and PHP are properly configured and accessible.

Step 2: Create a MySQL Database for WordPress

  • Log in to MySQL as the root user:
sudo mysql
  • Create a new MySQL database and user for WordPress:
CREATE DATABASE my_wordpress_db;
CREATE USER 'my_wordpress_user'@'localhost' IDENTIFIED BY 'your-password-here';
GRANT ALL PRIVILEGES ON my_wordpress_db.* TO 'my_wordpress_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 3: Download and Configure WordPress

  • Download the latest WordPress release and extract it to your Nginx web root directory:
cd /var/www/linuxchamp.com/
sudo curl -LO https://wordpress.org/latest.tar.gz
sudo tar xzvf latest.tar.gz
sudo mv wordpress/* .
sudo rm -rf wordpress latest.tar.gz
  • Configure WordPress by creating the wp-config.php file:
sudo cp wp-config-sample.php wp-config.php
sudo nano wp-config.php
  • Update the database settings in wp-config.php with the MySQL database, username, and password created earlier.

Step 5: Complete WordPress Installation

  • Open the domain(Hint: you have used this in the nginx block in the server_name section: linuxchamp.com or www.linuxchamp.com) or IP address of your WordPress installation in any web browser.
  • Follow the on-screen instructions to set up your WordPress site, including site title, admin username, password, and email.
  • After installation, log in to the WordPress admin dashboard and customize your site as needed.

Conclusion:

Congratulations! You’ve successfully installed WordPress on the LEMP stack (Ubuntu 22.04) and are ready to create, manage, and publish content with ease. Explore WordPress plugins, themes, and functionalities to enhance your website’s capabilities.

More from this stream

Recomended