Deploy a basic Apache HTTP server and publish a static landing page on port 80. Verify the unit is healthy, confirm the daemon is listening, then prove end-to-end delivery with a local HTTP request.
You need to deploy a basic Apache HTTP web server to serve a static landing page over port 80. Your job
is to install the package, enable and start the service, publish a custom index.html into the default web
root, then validate the response with a local HTTP request.
This is the standard “get it online safely” workflow: install, enable, verify status, publish content, then prove it’s reachable with a simple client check before you add TLS, virtual hosts, or firewall rules.
httpd/apache2) with the system package manager./var/www/html/index.html.curl.httpd on RHEL-family, apache2 on Debian/Ubuntu.
/var/www/html, but distro configs can override it.
Use the native package manager for your distro. On RHEL-family systems, prefer dnf over legacy
yum.
# RHEL / CentOS / Fedora
sudo dnf install -y httpd
# Debian/Ubuntu
sudo apt update
sudo apt install -y apache2
# Arch
sudo pacman -S apache
Installing Apache provides the server binaries, default configuration, and a systemd service unit. Next you will start the service and publish content.
# Example result (varies by distro):
# httpd/apache2 installed successfully.
# RHEL-family unit name:
sudo systemctl enable --now httpd
# Debian/Ubuntu unit name:
sudo systemctl enable --now apache2
enable --now starts the service immediately and ensures it returns after reboot.
# Quick check:
systemctl status httpd --no-pager
# or
systemctl status apache2 --no-pager
sudo ss -lntp | grep -E ':\b80\b' || true
This verifies the daemon is actually bound to the HTTP port. If you see no output, confirm the service is active and review unit logs.
# Example:
LISTEN 0 511 0.0.0.0:80 ... httpd
echo 'Hello from exit_0 (Lab 81)!' | sudo tee /var/www/html/index.html
Writing to /var/www/html requires elevated privileges. Using tee is a clean way to write as root
without opening an editor.
# Confirm file exists:
sudo cat /var/www/html/index.html
curl -s http://localhost
curl -I http://localhost
The first command proves content delivery. The second confirms you are getting a normal HTTP response (status, server, content type).
Hello from exit_0 (Lab 81)!
HTTP/1.1 200 OK
Confirm the correct unit name for your distro (httpd vs apache2) and inspect logs with
journalctl -u <unit>.
Check the daemon is listening on port 80 (ss -lntp). If it’s not, re-check the unit state and recent log
output.
Confirm the document root is /var/www/html for your build, and verify your file contents. Some distros use
different defaults or ship a default index page from another path.
If you want to revert to a clean state, stop/disable the service and remove the package using your distro’s package manager.
# Stop/disable
sudo systemctl disable --now httpd 2>/dev/null || true
sudo systemctl disable --now apache2 2>/dev/null || true
# Remove the custom page
sudo rm -f /var/www/html/index.html
dnf install httpd: Install Apache on RHEL-family systems.
apt install apache2: Install Apache on Debian/Ubuntu systems.
pacman -S apache: Install Apache on Arch.
systemctl enable --now <unit>: Enable at boot and start immediately.
httpd: Unit name on RHEL-family systems.apache2: Unit name on Debian/Ubuntu systems.ss -lntp: Show listening TCP sockets and owning processes.
-l: listening sockets-n: numeric output-t: TCP sockets-p: process info/var/www/html: Common default Apache document root.
tee: Write to privileged paths cleanly when used with sudo.
curl http://localhost: Validate a local HTTP response.
-I: fetch headers only-s: silent modejournalctl -u <unit>: View service logs for troubleshooting.
-n 50: last 50 lines--no-pager: print directly