Change DocumentRoot of the Apache Web Server

45 minutes
  • 4 Learning Objectives

About this Hands-on Lab

In this hands-on lab, your task is to change the DocumentRoot of the Apache web server. DocumentRoot changes also require other corresponding changes. First, we will create a new directory in a location with the proper permissions. The new directory and any nested directories will require read permissions. We will add the to the Apache configuration file. Next, copy the contents from the current directory to the new directory. SELinux will also need to be configured, so the new DocumentRoot can be accessible and able to serve the website to the client. We will verify the new changes. Lastly, we will restore the previous DocumentRoot along with the previous SELinux configuration to verify if the old DocumentRoot is accessible through the browser.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a New Directory for the DocumentRoot

Note: You must use a local terminal app program with ssh support for this lab (examples: The mac/linux terminal program, or the new Windows Terminal with WSL2). The Instant Terminal can not be used for this specific lab.

  1. Create a new directory.
  2. Edit the Apache configuration file.
Copy the Files
  1. Copy the files from the old directory to the new directory.
Configure Selinux and Restart Httpd
  1. Edit SELinux to allow the new directory, file and image.
  2. Restart Apache service.
  3. Verify changes by opening a new private/incognito browser using the public IP address of the cloud server.
Restore Original DocumentRoot and Verify Changes
  1. Edit Apache configuration file and revert to the original DocumentRoot.
  2. Verify changes by opening a new private/incognito browser using the public IP address of the cloud server.

Additional Resources

The initial SSH Port is 61613. Please use this port to connect to the server.

Note: You must use a local terminal app program with ssh support for this lab (examples: The mac/linux terminal program, or the new Windows Terminal with WSL2). The Instant Terminal can not be used for this specific lab.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?