learning app php ecommerce - degutos/wikis GitHub Wiki

Building an application with PHP and Apache

Introduction

This exercice is a simple guide on how to install a Centos istallation with Apache running httpd service, configuring firewalld service to start up and control access, we will open the necessary ports to enable access to this node.

This is a setup fork from https://github.com/degutos/learning-app-ecommerce

Checking our Linux version

[cloud_user@da503752af4c ~]$ cat /etc/os-release
NAME="CentOS Stream"
VERSION="9"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="9"
PLATFORM_ID="platform:el9"
PRETTY_NAME="CentOS Stream 9"
ANSI_COLOR="0;31"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:centos:centos:9"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux 9"
REDHAT_SUPPORT_PRODUCT_VERSION="CentOS Stream"

Deploy our pre-requisites

  1. Install Firewalld
sudo yum install -y firewalld

Example:

[cloud_user@da503752af4c ~]$ sudo yum install -y firewalld
[sudo] password for cloud_user:
CentOS Stream 9 - BaseOS                                                                                                           25 kB/s | 9.3 kB     00:00
CentOS Stream 9 - BaseOS                                                                                                           18 MB/s | 6.5 MB     00:00
CentOS Stream 9 - AppStream                                                                                                       110 kB/s | 9.8 kB     00:00
CentOS Stream 9 - AppStream                                                                                                       9.5 MB/s |  17 MB     00:01
CentOS Stream 9 - Extras packages                                                                                                 102 kB/s |  11 kB     00:00
Dependencies resolved.
==================================================================================================================================================================
 Package                                            Architecture                  Version                                  Repository                        Size
==================================================================================================================================================================
Installing:
 firewalld                                          noarch                        1.2.1-1.el9                              baseos                           526 k
Installing dependencies:
 firewalld-filesystem                               noarch                        1.2.1-1.el9                              baseos                           9.5 k
 gobject-introspection                              x86_64                        1.68.0-11.el9                            baseos                           250 k
 ipset                                              x86_64                        7.11-8.el9                               baseos                            43 k
 ipset-libs                                         x86_64                        7.11-8.el9                               baseos                            70 k
 iptables-nft                                       x86_64                        1.8.8-6.el9                              baseos                           203 k
 libnftnl                                           x86_64                        1.2.2-1.el9                              baseos                            84 k
 nftables                                           x86_64                        1:1.0.4-10.el9                           baseos                           401 k
 python3-firewall                                   noarch                        1.2.1-1.el9                              baseos                           386 k
 python3-gobject-base                               x86_64                        3.40.1-6.el9                             baseos                           183 k
 python3-gobject-base-noarch                        noarch                        3.40.1-6.el9                             baseos                           161 k
 python3-nftables                                   x86_64                        1:1.0.4-10.el9                           baseos                            22 k
Installing weak dependencies:
 libcap-ng-python3                                  x86_64                        0.8.2-7.el9                              appstream                         30 k

Transaction Summary
==================================================================================================================================================================
Install  13 Packages

Total download size: 2.3 M
Installed size: 8.2 M
Downloading Packages:
(1/13): gobject-introspection-1.68.0-11.el9.x86_64.rpm                                                                            1.8 MB/s | 250 kB     00:00
(2/13): firewalld-filesystem-1.2.1-1.el9.noarch.rpm                                                                                14 kB/s | 9.5 kB     00:00    A
(3/13): ipset-libs-7.11-8.el9.x86_64.rpm                                                                                          712 kB/s |  70 kB     00:00
(4/13): iptables-nft-1.8.8-6.el9.x86_64.rpm                                                                                        21 MB/s | 203 kB     00:00
(5/13): libnftnl-1.2.2-1.el9.x86_64.rpm                                                                                           6.1 MB/s |  84 kB     00:00
(6/13): nftables-1.0.4-10.el9.x86_64.rpm                                                                                           29 MB/s | 401 kB     00:00
(7/13): ipset-7.11-8.el9.x86_64.rpm                                                                                                64 kB/s |  43 kB     00:00
(8/13): firewalld-1.2.1-1.el9.noarch.rpm                                                                                          417 kB/s | 526 kB     00:01
(9/13): python3-gobject-base-3.40.1-6.el9.x86_64.rpm                                                                              198 kB/s | 183 kB     00:00
(10/13): python3-firewall-1.2.1-1.el9.noarch.rpm                                                                                  342 kB/s | 386 kB     00:01
(11/13): libcap-ng-python3-0.8.2-7.el9.x86_64.rpm                                                                                 4.4 MB/s |  30 kB     00:00
(12/13): python3-gobject-base-noarch-3.40.1-6.el9.noarch.rpm                                                                      170 kB/s | 161 kB     00:00
(13/13): python3-nftables-1.0.4-10.el9.x86_64.rpm                                                                                  32 kB/s |  22 kB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                             910 kB/s | 2.3 MB     00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: firewalld-1.2.1-1.el9.noarch                                                                                                             1/1
  Preparing        :                                                                                                                                          1/1
  Installing       : libnftnl-1.2.2-1.el9.x86_64                                                                                                             1/13
  Installing       : iptables-nft-1.8.8-6.el9.x86_64                                                                                                         2/13
  Running scriptlet: iptables-nft-1.8.8-6.el9.x86_64                                                                                                         2/13
  Installing       : nftables-1:1.0.4-10.el9.x86_64                                                                                                          3/13
  Running scriptlet: nftables-1:1.0.4-10.el9.x86_64                                                                                                          3/13
  Installing       : python3-nftables-1:1.0.4-10.el9.x86_64                                                                                                  4/13
  Installing       : libcap-ng-python3-0.8.2-7.el9.x86_64                                                                                                    5/13
  Installing       : ipset-libs-7.11-8.el9.x86_64                                                                                                            6/13
  Installing       : ipset-7.11-8.el9.x86_64                                                                                                                 7/13
  Installing       : gobject-introspection-1.68.0-11.el9.x86_64                                                                                              8/13
  Installing       : python3-gobject-base-noarch-3.40.1-6.el9.noarch                                                                                         9/13
  Installing       : python3-gobject-base-3.40.1-6.el9.x86_64                                                                                               10/13
  Installing       : python3-firewall-1.2.1-1.el9.noarch                                                                                                    11/13
  Installing       : firewalld-filesystem-1.2.1-1.el9.noarch                                                                                                12/13
  Installing       : firewalld-1.2.1-1.el9.noarch                                                                                                           13/13
  Running scriptlet: firewalld-1.2.1-1.el9.noarch                                                                                                           13/13
Created symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service → /usr/lib/systemd/system/firewalld.service.
Created symlink /etc/systemd/system/multi-user.target.wants/firewalld.service → /usr/lib/systemd/system/firewalld.service.

  Verifying        : firewalld-1.2.1-1.el9.noarch                                                                                                            1/13
  Verifying        : firewalld-filesystem-1.2.1-1.el9.noarch                                                                                                 2/13
  Verifying        : gobject-introspection-1.68.0-11.el9.x86_64                                                                                              3/13
  Verifying        : ipset-7.11-8.el9.x86_64                                                                                                                 4/13
  Verifying        : ipset-libs-7.11-8.el9.x86_64                                                                                                            5/13
  Verifying        : iptables-nft-1.8.8-6.el9.x86_64                                                                                                         6/13
  Verifying        : libnftnl-1.2.2-1.el9.x86_64                                                                                                             7/13
  Verifying        : nftables-1:1.0.4-10.el9.x86_64                                                                                                          8/13
  Verifying        : python3-firewall-1.2.1-1.el9.noarch                                                                                                     9/13
  Verifying        : python3-gobject-base-3.40.1-6.el9.x86_64                                                                                               10/13
  Verifying        : python3-gobject-base-noarch-3.40.1-6.el9.noarch                                                                                        11/13
  Verifying        : python3-nftables-1:1.0.4-10.el9.x86_64                                                                                                 12/13
  Verifying        : libcap-ng-python3-0.8.2-7.el9.x86_64                                                                                                   13/13

Installed:
  firewalld-1.2.1-1.el9.noarch                      firewalld-filesystem-1.2.1-1.el9.noarch             gobject-introspection-1.68.0-11.el9.x86_64
  ipset-7.11-8.el9.x86_64                           ipset-libs-7.11-8.el9.x86_64                        iptables-nft-1.8.8-6.el9.x86_64
  libcap-ng-python3-0.8.2-7.el9.x86_64              libnftnl-1.2.2-1.el9.x86_64                         nftables-1:1.0.4-10.el9.x86_64
  python3-firewall-1.2.1-1.el9.noarch               python3-gobject-base-3.40.1-6.el9.x86_64            python3-gobject-base-noarch-3.40.1-6.el9.noarch
  python3-nftables-1:1.0.4-10.el9.x86_64

Complete!
  1. Starting firewalld service
[cloud_user@da503752af4c ~]$ sudo systemctl start firewalld
[cloud_user@da503752af4c ~]$
  1. Enabling firewalld service
[cloud_user@da503752af4c ~]$ sudo systemctl enable firewalld

Deploy and configure database

  1. Installing MariaDB
[cloud_user@da503752af4c ~]$ sudo yum install -y mariadb-server
Last metadata expiration check: 0:02:01 ago on Tue 11 Jul 2023 09:01:35 PM UTC.
Dependencies resolved.
==================================================================================================================================================================
 Package                                          Architecture                 Version                                      Repository                       Size
==================================================================================================================================================================
Installing:
 mariadb-server                                   x86_64                       3:10.5.16-2.el9                              appstream                       9.4 M
Installing dependencies:
 libaio                                           x86_64                       0.3.111-13.el9                               baseos                           24 k
 mariadb                                          x86_64                       3:10.5.16-2.el9                              appstream                       1.6 M
 mariadb-common                                   x86_64                       3:10.5.16-2.el9                              appstream                        35 k
 mariadb-connector-c                              x86_64                       3.2.6-1.el9                                  appstream                       198 k
 mariadb-connector-c-config                       noarch                       3.2.6-1.el9                                  appstream                        11 k
 mariadb-errmsg                                   x86_64                       3:10.5.16-2.el9                              appstream                       223 k
 mysql-selinux                                    noarch                       1.0.5-1.el9                                  appstream                        36 k
 perl-DBD-MariaDB                                 x86_64                       1.21-16.el9                                  appstream                       152 k
 perl-DBI                                         x86_64                       1.643-9.el9                                  appstream                       725 k
 perl-DynaLoader                                  x86_64                       1.47-480.el9                                 appstream                        27 k
 perl-File-Copy                                   noarch                       2.34-480.el9                                 appstream                        21 k
 perl-Math-BigInt                                 noarch                       1:1.9998.18-460.el9                          appstream                       190 k
 perl-Math-Complex                                noarch                       1.59-480.el9                                 appstream                        48 k
 perl-Sys-Hostname                                x86_64                       1.23-480.el9                                 appstream                        18 k
Installing weak dependencies:
 mariadb-backup                                   x86_64                       3:10.5.16-2.el9                              appstream                       6.4 M
 mariadb-gssapi-server                            x86_64                       3:10.5.16-2.el9                              appstream                        20 k
 mariadb-server-utils                             x86_64                       3:10.5.16-2.el9                              appstream                       218 k

Transaction Summary
==================================================================================================================================================================
Install  18 Packages

Total download size: 19 M
Installed size: 111 M
Downloading Packages:
(1/18): libaio-0.3.111-13.el9.x86_64.rpm                                                                                          183 kB/s |  24 kB     00:00
(2/18): mariadb-10.5.16-2.el9.x86_64.rpm                                                                                          4.9 MB/s | 1.6 MB     00:00
(3/18): mariadb-connector-c-3.2.6-1.el9.x86_64.rpm                                                                                 14 MB/s | 198 kB     00:00
(4/18): mariadb-connector-c-config-3.2.6-1.el9.noarch.rpm                                                                         2.0 MB/s |  11 kB     00:00
(5/18): mariadb-backup-10.5.16-2.el9.x86_64.rpm                                                                                   7.1 MB/s | 6.4 MB     00:00
(6/18): mariadb-common-10.5.16-2.el9.x86_64.rpm                                                                                    44 kB/s |  35 kB     00:00
(7/18): mariadb-errmsg-10.5.16-2.el9.x86_64.rpm                                                                                   215 kB/s | 223 kB     00:01
(8/18): mariadb-gssapi-server-10.5.16-2.el9.x86_64.rpm                                                                             40 kB/s |  20 kB     00:00
(9/18): mariadb-server-10.5.16-2.el9.x86_64.rpm                                                                                    11 MB/s | 9.4 MB     00:00
(10/18): perl-DBD-MariaDB-1.21-16.el9.x86_64.rpm                                                                                   12 MB/s | 152 kB     00:00
(11/18): perl-DBI-1.643-9.el9.x86_64.rpm                                                                                          7.3 MB/s | 725 kB     00:00
(12/18): perl-DynaLoader-1.47-480.el9.x86_64.rpm                                                                                  638 kB/s |  27 kB     00:00
(13/18): mysql-selinux-1.0.5-1.el9.noarch.rpm                                                                                      55 kB/s |  36 kB     00:00
(14/18): perl-Math-BigInt-1.9998.18-460.el9.noarch.rpm                                                                             20 MB/s | 190 kB     00:00
(15/18): perl-Math-Complex-1.59-480.el9.noarch.rpm                                                                                6.6 MB/s |  48 kB     00:00
(16/18): perl-Sys-Hostname-1.23-480.el9.x86_64.rpm                                                                                3.5 MB/s |  18 kB     00:00
(17/18): mariadb-server-utils-10.5.16-2.el9.x86_64.rpm                                                                            228 kB/s | 218 kB     00:00
(18/18): perl-File-Copy-2.34-480.el9.noarch.rpm                                                                                    33 kB/s |  21 kB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                             7.0 MB/s |  19 MB     00:02
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                          1/1
  Installing       : mariadb-connector-c-config-3.2.6-1.el9.noarch                                                                                           1/18
  Installing       : mariadb-common-3:10.5.16-2.el9.x86_64                                                                                                   2/18
  Installing       : mariadb-connector-c-3.2.6-1.el9.x86_64                                                                                                  3/18
  Installing       : perl-Sys-Hostname-1.23-480.el9.x86_64                                                                                                   4/18
  Installing       : perl-DynaLoader-1.47-480.el9.x86_64                                                                                                     5/18
  Installing       : libaio-0.3.111-13.el9.x86_64                                                                                                            6/18
  Installing       : mariadb-errmsg-3:10.5.16-2.el9.x86_64                                                                                                   7/18
  Installing       : perl-Math-Complex-1.59-480.el9.noarch                                                                                                   8/18
  Installing       : perl-Math-BigInt-1:1.9998.18-460.el9.noarch                                                                                             9/18
  Installing       : perl-DBI-1.643-9.el9.x86_64                                                                                                            10/18
  Installing       : perl-DBD-MariaDB-1.21-16.el9.x86_64                                                                                                    11/18
  Installing       : perl-File-Copy-2.34-480.el9.noarch                                                                                                     12/18
  Running scriptlet: mysql-selinux-1.0.5-1.el9.noarch                                                                                                       13/18
  Installing       : mysql-selinux-1.0.5-1.el9.noarch                                                                                                       13/18
  Running scriptlet: mysql-selinux-1.0.5-1.el9.noarch                                                                                                       13/18
libsemanage.semanage_direct_install_info: Overriding mysql module at lower priority 100 with module at priority 200.

  Installing       : mariadb-3:10.5.16-2.el9.x86_64                                                                                                         14/18
  Installing       : mariadb-backup-3:10.5.16-2.el9.x86_64                                                                                                  15/18
  Installing       : mariadb-gssapi-server-3:10.5.16-2.el9.x86_64                                                                                           16/18
  Installing       : mariadb-server-utils-3:10.5.16-2.el9.x86_64                                                                                            17/18
  Running scriptlet: mariadb-server-3:10.5.16-2.el9.x86_64                                                                                                  18/18
  Installing       : mariadb-server-3:10.5.16-2.el9.x86_64                                                                                                  18/18
  Running scriptlet: mariadb-server-3:10.5.16-2.el9.x86_64                                                                                                  18/18
  Running scriptlet: mysql-selinux-1.0.5-1.el9.noarch                                                                                                       18/18
  Running scriptlet: mariadb-server-3:10.5.16-2.el9.x86_64                                                                                                  18/18

  Verifying        : libaio-0.3.111-13.el9.x86_64                                                                                                            1/18
  Verifying        : mariadb-3:10.5.16-2.el9.x86_64                                                                                                          2/18
  Verifying        : mariadb-backup-3:10.5.16-2.el9.x86_64                                                                                                   3/18
  Verifying        : mariadb-common-3:10.5.16-2.el9.x86_64                                                                                                   4/18
  Verifying        : mariadb-connector-c-3.2.6-1.el9.x86_64                                                                                                  5/18
  Verifying        : mariadb-connector-c-config-3.2.6-1.el9.noarch                                                                                           6/18
  Verifying        : mariadb-errmsg-3:10.5.16-2.el9.x86_64                                                                                                   7/18
  Verifying        : mariadb-gssapi-server-3:10.5.16-2.el9.x86_64                                                                                            8/18
  Verifying        : mariadb-server-3:10.5.16-2.el9.x86_64                                                                                                   9/18
  Verifying        : mariadb-server-utils-3:10.5.16-2.el9.x86_64                                                                                            10/18
  Verifying        : mysql-selinux-1.0.5-1.el9.noarch                                                                                                       11/18
  Verifying        : perl-DBD-MariaDB-1.21-16.el9.x86_64                                                                                                    12/18
  Verifying        : perl-DBI-1.643-9.el9.x86_64                                                                                                            13/18
  Verifying        : perl-DynaLoader-1.47-480.el9.x86_64                                                                                                    14/18
  Verifying        : perl-File-Copy-2.34-480.el9.noarch                                                                                                     15/18
  Verifying        : perl-Math-BigInt-1:1.9998.18-460.el9.noarch                                                                                            16/18
  Verifying        : perl-Math-Complex-1.59-480.el9.noarch                                                                                                  17/18
  Verifying        : perl-Sys-Hostname-1.23-480.el9.x86_64                                                                                                  18/18

Installed:
  libaio-0.3.111-13.el9.x86_64                        mariadb-3:10.5.16-2.el9.x86_64                       mariadb-backup-3:10.5.16-2.el9.x86_64
  mariadb-common-3:10.5.16-2.el9.x86_64               mariadb-connector-c-3.2.6-1.el9.x86_64               mariadb-connector-c-config-3.2.6-1.el9.noarch
  mariadb-errmsg-3:10.5.16-2.el9.x86_64               mariadb-gssapi-server-3:10.5.16-2.el9.x86_64         mariadb-server-3:10.5.16-2.el9.x86_64
  mariadb-server-utils-3:10.5.16-2.el9.x86_64         mysql-selinux-1.0.5-1.el9.noarch                     perl-DBD-MariaDB-1.21-16.el9.x86_64
  perl-DBI-1.643-9.el9.x86_64                         perl-DynaLoader-1.47-480.el9.x86_64                  perl-File-Copy-2.34-480.el9.noarch
  perl-Math-BigInt-1:1.9998.18-460.el9.noarch         perl-Math-Complex-1.59-480.el9.noarch                perl-Sys-Hostname-1.23-480.el9.x86_64

Complete!
  1. Starting database mariadb and enabling it
[cloud_user@da503752af4c ~]$ sudo systemctl enable mariadb --now
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
  1. Configuring firewall for the database
[cloud_user@da503752af4c ~]$ sudo firewall-cmd --permanent --zone=public --add-port=3306/tcp
success

[cloud_user@da503752af4c ~]$ sudo firewall-cmd --reload
success
  1. Configuring Database
[cloud_user@da503752af4c ~]$ sudo mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.5.16-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database ecomdb;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]>
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| ecomdb             |
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
4 rows in set (0.001 sec)
MariaDB [(none)]> CREATE USER 'ecomuser'@'localhost' IDENTIFIED BY 'ecompassword';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'ecomuser'@'localhost';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]>

| ON a multi-node setup remember to provide the IP address of the web server here: 'ecomuser'@'web-server-ip'

  1. Load Product inventory Information to database
[cloud_user@da503752af4c ~]$ cat > db-load-script.sql
USE ecomdb;
CREATE TABLE products (id mediumint(8) unsigned NOT NULL auto_increment,Name varchar(255) default NULL,Price varchar(255) default NULL, ImageUrl varchar(255) default NULL,PRIMARY KEY (id)) AUTO_INCREMENT=1;

INSERT INTO products (Name,Price,ImageUrl) VALUES ("Laptop","100","c-1.png"),("Drone","200","c-2.png"),("VR","300","c-3.png"),("Tablet","50","c-5.png"),("Watch","90","c-6.png"),("Phone Covers","20","c-7.png"),("Phone","80","c-8.png"),("Laptop","150","c-4.png");

^C

Run the script

[cloud_user@da503752af4c ~]$ sudo mysql < db-load-script.sql

Check the database data:

MariaDB [ecomdb]> select * from products;
+----+--------------+-------+----------+
| id | Name         | Price | ImageUrl |
+----+--------------+-------+----------+
|  1 | Laptop       | 100   | c-1.png  |
|  2 | Drone        | 200   | c-2.png  |
|  3 | VR           | 300   | c-3.png  |
|  4 | Tablet       | 50    | c-5.png  |
|  5 | Watch        | 90    | c-6.png  |
|  6 | Phone Covers | 20    | c-7.png  |
|  7 | Phone        | 80    | c-8.png  |
|  8 | Laptop       | 150   | c-4.png  |
+----+--------------+-------+----------+
8 rows in set (0.000 sec)

Deploy and configure web service

  1. Install required packages
[cloud_user@da503752af4c ~]$ sudo yum install -y httpd php php-mysqlnd
  1. Opening firewall port for access port 80 tcp
[cloud_user@da503752af4c ~]$ sudo firewall-cmd --permanent --zone=public --add-port=80/tcp
success

[cloud_user@da503752af4c ~]$ sudo firewall-cmd --reload
success
  1. Configuring index.html to index.php
[cloud_user@da503752af4c ~]$ sudo cat /etc/httpd/conf/httpd.conf | grep -i "directoryindex "
    DirectoryIndex index.html
[cloud_user@da503752af4c ~]$ sudo sed -i 's/index.html/index.php/g' /etc/httpd/conf/httpd.conf
[cloud_user@da503752af4c ~]$ sudo cat /etc/httpd/conf/httpd.conf | grep -i "directoryindex "
    DirectoryIndex index.php
  1. Start httpd
[cloud_user@da503752af4c ~]$ sudo systemctl start httpd
[cloud_user@da503752af4c ~]$ sudo systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
  1. Download code
[cloud_user@da503752af4c ~]$ sudo yum install -y git
[cloud_user@da503752af4c ~]$ sudo git clone https://github.com/kodekloudhub/learning-app-ecommerce.git /var/www/html/
Cloning into '/var/www/html'...
remote: Enumerating objects: 157, done.
remote: Counting objects: 100% (41/41), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 157 (delta 34), reused 33 (delta 33), pack-reused 116
Receiving objects: 100% (157/157), 1.79 MiB | 4.46 MiB/s, done.
Resolving deltas: 100% (41/41), done.
  1. Update index.php
[cloud_user@da503752af4c ~]$ sudo sed -i 's/172.20.1.101/localhost/g' /var/www/html/index.php

ON a multi-node setup remember to provide the IP address of the database server here.

  1. Testing
curl http://localhost

Open your browser and access the Node URL or iP: Example: http://da503752af4c.mylabserver.com