LPIC-1 Essential System Services and Networking Practice Question
A developer asks the system administrator to configure a local web server for testing using Apache. The server should serve files from /var/www/test. Which directive must be set in the Apache configuration to set this document root?
⚠ Common exam trap
Watch out — candidates often confuse DocumentRoot with ServerRoot or Alias, often thinking ServerRoot defines where web files are served from, when in fact it points to Apache's own installation directory.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
DocumentRoot /var/www/test
The DocumentRoot directive in Apache defines the top-level directory from which it serves files for a given virtual host or the main server. Setting DocumentRoot /var/www/test tells Apache to map incoming HTTP requests to files under that directory, making it the correct choice for serving files from /var/www/test.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Alias /test /var/www/test
Why it's wrong here
Alias maps a URL path to a filesystem location outside the document root, so requests to /test would resolve there while the document root stays unchanged. It is tempting because Alias genuinely serves content from arbitrary directories, which is correct when adding an extra URL path alongside an existing root — not when replacing the root itself.
- ✗
ServerRoot /var/www/test
Why it's wrong here
ServerRoot sets the directory containing Apache's configuration and runtime files, not the served content. It tempts because both directives name a filesystem path, but the document root is defined by DocumentRoot /var/www/test, which maps URLs to that directory.
- ✓
DocumentRoot /var/www/test
Why this is correct
DocumentRoot defines the directory from which Apache serves files, so setting DocumentRoot /var/www/test makes that path the web root. Requests then resolve against /var/www/test, satisfying the requirement for a local test server serving that location.
- ✗
DirectoryIndex /var/www/test
Why it's wrong here
DirectoryIndex maps a request for a directory to a default filename such as index.html; it does not define where Apache looks for content. It would be correct when a site needs a specific landing page served for directory requests. Setting the document root requires DocumentRoot /var/www/test instead.
Go deeper
Related to this question
About these practice questions
One of 402 original LPIC-1 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This LPIC-1 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-1 exam.