How To Install Latest NGINX, PHP 7.3, MariaDB On Centos 7

If you want to install the latest php with nginx and mariadb, this blog is the right writing for you


Update and upgrade your OS.

sudo su
yum update -y
yum upgrade -y

Create the file named /etc/yum.repos.d/nginx.repo.

vi /etc/yum.repos.d/nginx.repo

Following contents:

name=nginx repo

Replace “OS” with “rhel” or “centos”, depending on the distribution used, and “OSRELEASE” with “6” or “7”, for 6.x or 7.x versions, respectively or read this URL for detail instruction

After follow that instruction, update again your OS

yum update -y

Install nginx via command line

yum install nginx -y

Enable nginx if the system boots.

systemctl enable nginx

Start nginx service

systemctl start nginx

PHP 7.3.x

Update and upgrade your OS.

sudo su
yum update -y
yum upgrade -y

Turn on EPEL repo

yum install epel-release

Install remi repo

yum install

Install yum utils

yum install yum-utils

Enable remi repo

yum-config-manager --enable remi-php73
yum update -y

Install PHP 7.3

yum install php

* make sure there is php version 7.3.x

Install PHP FastCGI Process Manager with commonly used modules

yum install php-fpm php-gd php-json php-mbstring php-mysqlnd php-xml php-xmlrpc php-opcache

Verification PHP was installed correctly

php --version
php --modules

Enable systemctl for PHP

systemctl enable php-fpm.service

Start PHP service

systemctl start php-fpm.service


Find nginx user and group

egrep '^(user|group)' /etc/nginx/nginx.conf

Edit php-fpm configuration

vi /etc/php-fpm.d/www.conf

Set user and group to nginx

user = nginx
group = nginx

Restart php-fpm service

systemctl restart php-fpm.service

Edit nginx configuration

vi /etc/nginx/conf.d/default.conf

Follow this config

location ~ \.php$ {
        root /usr/share/nginx/html;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;

Restart nginx service

systemctl restart nginx

Create file test.php for verification installation was correctly

vi /usr/share/nginx/html/test.php

Follow this code for content test.php


Open URL for testing


Screenshhot if php and nginx was installed correctly


Open this URL for get repo configuration.

Write the repo config to file

vi /etc/yum.repos.d/MariaDB.repo

Update OS

yum update -y

Install MariaDB

yum install MariaDB-server MariaDB-client

Enable systemctl mariadb

systemctl enable mariadb

Run mariadb service

systemctl start mariadb

Install via command


Yeaaaaayyy,, you are finished all instruction… Thanks for following this instruction.