Apache: Publish a Name-Based Virtual Host
MediumNetworking15-25 minApache serves only its default site. Publish a name-based virtual host for the assigned domain. Your assignment is in /root/case/assignment.env (SERVERNAME, DOCROOT).
Two steps:
1. Create a vhost file in /etc/apache2/sites-available/ with a port-80 server block: <VirtualHost *:80> containing ServerName SERVERNAME and DocumentRoot DOCROOT.
2. Enable the site by symlinking it into /etc/apache2/sites-enabled/ — exactly what a2ensite does.
Write the ServerName SERVERNAME and DocumentRoot DOCROOT directives (a space or a tab between the directive and its value is fine, and the value may be quoted). Grading reads the Apache config (it does not start apache2). On a live host: apache2ctl configtest then systemctl reload apache2. See /root/case/brief.txt.
- Read the per-session ServerName and document root
- Write a <VirtualHost *:80> block with ServerName and DocumentRoot
- Place it in sites-available
- Enable the site with a symlink into sites-enabled (a2ensite)
Hands-on lab: you work on a real Linux box in your browser, graded on the machine's actual state.
