Lab 007: Install and Configure Web Application
Requirements
xFusionCorp Industries is planning to host two static websites on their infra in Stratos Datacenter. The development of these websites is still in -progress, but we want to get the servers ready. The storage server has a shared directory /data that is mounted on each app host under /var/www/html directory. Please perform the following steps to accomplish the task:
a. Install httpd package and dependencies on all app hosts.
b. Apache should serve on port 8080 within the apps.
c. There are two website backups /home/thor/ecommerce and /home/thor/cluster on jump_host. Set them up on Apache in a way that ecommerce should work on link http://<lb-url>/ecommerce/ and cluster should work on link http://<lb-url>/cluster. (do not worry about load balancer configuration, as its already configured).
d. You can access the website on LBR link; to do so click on the + button on top of your terminal, select the option Select port to view on Host 1, and after adding port 80 click on Display Port.
This lab configures Apache HTTP server to host multiple virtual directories. Ensure all app servers are configured consistently for proper load balancing.
Prerequisites
- Access to all app servers (stapp01, stapp02, stapp03) with root or sudo privileges
- Website backup files available at
/home/thor/ecommerceand/home/thor/clusteron jump host - NFS mount point
/datamapped to/var/www/htmlon all app servers - Load balancer already configured
Steps
# 1. Install Apache httpd
sudo yum install -y httpd
# 2. Modify Apache configuration to listen on port 8080
sudo sed -i 's/Listen 80/Listen 8080/g' /etc/httpd/conf/httpd.conf
# 3. Copy website backups to app servers
# (Run on each app server or via SCP from jump host)
sudo cp -r /tmp/ecommerce /var/www/html/
sudo cp -r /tmp/cluster /var/www/html/
# 4. Enable and start Apache service
sudo systemctl enable httpd
sudo systemctl start httpd
sudo systemctl status httpd
# 5. Verify websites are accessible
curl -4 http://localhost:8080/ecommerce/
curl -4 http://localhost:8080/cluster/
Verification
Test website accessibility on all app servers:
# From jump host or any client
curl -4 http://stapp01:8080/ecommerce/
curl -4 http://stapp01:8080/cluster/
curl -4 http://stapp02:8080/ecommerce/
curl -4 http://stapp02:8080/cluster/
curl -4 http://stapp03:8080/ecommerce/
curl -4 http://stapp03:8080/cluster/
# Access through load balancer web UI from the portal