Day 18: Configure LAMP server (100 Days of DevOps)

I’m facing this issue repeatedly. Can someone help identify and resolve the problem? Please refer to the screenshot below.






Here the command

Database server

ssh peter@stdb01

sudo yum install -y mariadb-server
sudo systemctl enable mariadb
sudo systemctl start mariadb
sudo mysql -u root -p

CREATE DATABASE kodekloud_db3;
CREATE USER ‘kodekloud_gem’@‘%’ IDENTIFIED BY ‘GyQkFRVNr3’;
GRANT ALL PRIVILEGES ON kodekloud_db3.* TO ‘kodekloud_gem’@‘%’;
FLUSH PRIVILEGES;
EXIT;

mysql -u kodekloud_gem -p # check

Three application servers

ssh tony@stapp01
ssh steve@stapp02
ssh banner@stapp03

sudo yum install -y httpd php php-mysqlnd php-fpm php-cli
sudo systemctl start httpd
sudo systemctl enable httpd
sudo yum install -y php-mysqlnd
sudo vi /etc/httpd/conf/httpd.conf
sudo systemctl restart httpd
sudo systemctl enable httpd
sudo systemctl status httpd
sudo yum install wget
cd /var/www/html

sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xvzf latest.tar.gz
sudo mv wordpress/* .
sudo rm -rf wordpress
sudo rm latest.tar.gz

sudo cp wp-config-sample.php wp-config.php
sudo vi wp-config.php

define( ‘DB_NAME’, ‘kodekloud_db3’ );
define( ‘DB_USER’, ‘kodekloud_gem’ );
define( ‘DB_PASSWORD’, ‘GyQkFRVNr3’ );
define( ‘DB_HOST’, ‘stdb01.stratos.xfusioncorp.com’ );

sudo systemctl restart httpd
sudo systemctl enable httpd
sudo systemctl status httpd

Here httpd.conf file

ServerRoot “/etc/httpd”
Listen 5002
Include conf.modules.d/*.conf
User apache
Group apache
<VirtualHost *:5002>
DocumentRoot “/var/www/html”
ServerName stapp01.stratos.xfusioncorp.com # (Also, use here stapp02, stapp03)

# Ensure the directory permissions are correct
<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

# ErrorLog and CustomLog for this virtual host (optional)
ErrorLog "/var/log/httpd/stapp01_error_log"
CustomLog "/var/log/httpd/stapp01_access_log" combined

ServerAdmin root@localhost

AllowOverride none Require all denied

DocumentRoot “/var/www/html”

<Directory “/var/www”>
AllowOverride None
# Allow open access:
Require all granted

<Directory “/var/www/html”>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted

DirectoryIndex index.html

<Files “.ht*”>
Require all denied

ErrorLog “logs/error_log”

LogLevel warn

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
  LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>

CustomLog "logs/access_log" combined
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

<Directory “/var/www/cgi-bin”>
AllowOverride None
Options None
Require all granted

TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

AddDefaultCharset UTF-8

MIMEMagicFile conf/magic

EnableSendfile on

IncludeOptional conf.d/*.conf

Hi @jakir-ruet

There’s no need to download WordPress and related stuff.

You just need to:

  • Install MariaDB on DB Server
  • Create a Database on the DB Server with the provided user and password

On all the app-servers, install httpd

  • sudo yum install httpd -y

And all their dependencies

  • sudo yum install php php-mysqlnd php-pdo php-gd php-mbstring -y

Update the Port in /etc/httpd/conf/httpd.conf on All Servers

Start and enable httpd on all the app-servers.

Also, no need to post on different platforms; you can keep your query in one place. Someone from the team will surely reply.

Thanks a lot. It working now.

Can you please share what worked for you?
I did this lab 3 times and I am not sure what is wrong with my configuration because I can clearly see curl the LB and notice the HTML page.
Screenshot 2025-08-23 212912

check this , it may be helpful : 100-Days-Of-DevOps-KodeKloud-Challenges-Solutions

I don’t understand how this challenge is related to DevOps? Also I just get default httpd page even though everything is configured, I’m already exhausted by re-doing so many steps to get failed in the end and then re-do again