CompTIA Server+ (SK0-005)TroubleshootingMedium
A server administrator is configuring a new web server running Apache on a Linux distribution. After installing Apache and attempting to start the service, the administrator receives an error message indicating that the service failed to start because 'the document root /var/www/html does not exist or is not a directory'. Which of the following is the MOST appropriate first step to resolve this issue?
- AReinstall Apache to ensure all default directories are created.
- BCreate the missing `/var/www/html` directory and set appropriate permissions.
- CModify the Apache configuration to point to a different document root.
- DCheck the firewall rules to ensure port 80 is open.
Show answer & explanationAnswer & explanation
Correct answer: B. Create the missing `/var/www/html` directory and set appropriate permissions.
The error message explicitly states that the document root `/var/www/html` does not exist or is not a directory. The most direct and appropriate first step is to simply create this directory, as it's a fundamental requirement for Apache to serve web content, and then ensure it has the correct permissions for Apache to access it.
Why the other options are wrong
- A. Reinstalling Apache is usually unnecessary and more time-consuming if the only issue is a missing directory.
- C. Modifying the configuration is a possible solution, but it's often better to adhere to default paths if possible, and creating the missing directory is a more direct fix for the stated error.
- D. Firewall rules prevent incoming connections, but they do not prevent a service from starting due to a missing local directory.
Apache Document Root
The document root is the directory on a web server where web content (HTML, images, etc.) is stored and served from.
- Must exist and be accessible by the web server process.
- Typically specified in the Apache configuration file (httpd.conf/apache2.conf).
- Common default locations include /var/www/html or /srv/www.
Memory trick: Root folder missing, web server's fizzing.