Exercise
Serving a Web Page Exercise
Task
Stand up a web server on servera and
publish two pages, one at the site root and one in a
subdirectory, then confirm Apache serves both.
- Host
servera- Home page
http://servera/- Second page
-
http://servera/about/contact-us.html
-
Install httpd
sudo -i dnf install -y httpd systemctl is-enabled httpd systemctl is-active httpd -
Write a home page
Check where Apache serves from, then write a file there.
grep DocumentRoot /etc/httpd/conf/httpd.conf vim /var/www/html/index.html<h1>Welcome to servera</h1> -
Enable and start the service
systemctl enable --now httpd systemctl is-active httpd curl http://localhost/ -
Add a page in a subdirectory
mkdir /var/www/html/about vim /var/www/html/about/contact-us.html<h1>Contact Us</h1>curl http://localhost/about/contact-us.html -
Clean up
sudo systemctl disable --now httpd sudo rm -rf /var/www/html/index.html /var/www/html/about sudo dnf remove -y httpd