How to Install WordPress with Nginx and PHP 7.4 on CentOS 7

How to Install WordPress with Nginx and PHP 7.4 on CentOS 7

This tutorial discusses how to install WordPress with the Nginx web server paired with PHP v7.4 and MariaDB database or more popularly abbreviated as LEMP (Linux Nginx MySQL/MariaDB PHP).

0.Update System

Update CentOS and install the EPEL repository.

1.Install Nginx

Install Nginx.

Enable and start the Nginx service.

Nginx service status
Nginx service status

2.Install PHP 7.4

Install yum-utils and REMI repository.

Verify the results of installing the REMI repository, see the contents of the yum.repos.d directory.

yum.repos.d directory
yum.repos.d directory

Enable REMI PHP7.4 repository.

Install PHP 7.4 along with the required extensions.

Create a php symbolic link to php74 and check the installed PHP.

Command php -v
Command php -v

Configure PHP-FPM.

Change the options as below.

Enable and start PHP-FPM service.

PHP-FPM service status
PHP-FPM service status

3.Create Nginx Server Block

Creating a server block configuration file, replace DOMAIN.COM with the domain name you are using.

Block server configuration script.

Create root directory and info.php file.

Test the configuration and restart the Nginx service.

Test whether Nginx is able to run PHP scripts by accessing info.php.

Browse http://DOMAIN.COM/info.php.

PHP Information
PHP Information

4.Install MariaDB

Create file MariaDB 10.4 repository.

Script mariadb.repo.

Install MariaDB.

Enable and start the MariaDB service.

MariaDB service status
MariaDB service status

Secure the installation of MariaDB.

Answer the questions displayed.

Log in to MariaDB.

Creating database, user and password, and granting database access rights to user.

5.Install WordPress

Download the latest WordPress.

Extract latest.tar.gz.

Copy the contents of the wordpress directory to the root directory.

Change owner and root directory permissions.

Browse http://DOMAIN.COM.

  1. Language selection, use English (United States). Then Continue.
  2. Choose Language
    Choose Language
  3. Let’s go!
  4. Database information
    Database information
  5. Enter DBNAME, DBUSER, dan DBPASS. Submit.
  6. Copy the configuration text that is displayed.
  7. Script wp-config.php
    Script wp-config.php
  8. Create file wp-config.php then paste the text that has been copied.
  9. Run the installation.
  10. Enter Site Title, Username, Password, Your Email. Install WordPress.
  11. Website information
    Website information
  12. WordPress has been installed.
  13. Click Log In to log in to the dashboard.
  14. WordPress installed
    WordPress installed

6.Done

Front page http://DOMAIN.COM.

WordPress site
WordPress site

Dashboard page http://DOMAIN.COM/wp-admin.

WordPress dashboard
WordPress dashboard

2 Comments

  1. Hello,

    Thanks for the tutorial it works.

    I now needs help to make the site loads via https, please do a tutorial on this too.

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *