Quiz

Apache Web Server Final Quiz

Test your Apache HTTP Server knowledge with 10 self-paced multiple-choice questions covering configuration, virtual hosts, modules, access control, logging, service administration, and HTTPS.

Quiz Instructions

This final assessment contains 10 multiple-choice questions about Apache HTTP Server administration and configuration. It is self-paced, so there is no time limit.

Choose the best answer for each question. You may leave the assessment and resume it later. After submitting your answers, use the answer-review stage to compare your choices with the correct answers and explanations.

Quiz Coverage Map

Question numberTopicSkill assessedQuestion format
1Apache fundamentalsIdentify the web server's roleDefinition
2Configuration structureRecognize directives, includes, and syntax testingScenario
3Document rootsMap a URL path to a filesystem pathPractical diagnosis
4Virtual hostingUse hostnames to select a siteConfiguration interpretation
5ModulesDistinguish module enablement from feature configurationConcept
6Access controlSeparate authentication from authorizationSecurity scenario
7Logging and status codesChoose appropriate diagnostic sourcesTroubleshooting
8Service administrationValidate and apply changes safelyCommand selection
9HTTPSRecognize TLS virtual-host requirementsConfiguration interpretation
10Integrated troubleshootingDiagnose a failed or misdirected requestScenario

Questions

Question 1: Apache fundamentals

What is the primary role of Apache HTTP Server?

  1. It is a web browser that requests pages from other servers.
  2. It is web server software that receives HTTP requests and returns web content or responses.
  3. It is an operating system used to host websites.
  4. It is a database server that stores all website data.

Question 2: Configuration structure

An administrator edits an included Apache configuration fragment. Which action should normally occur before applying the change?

  1. Delete the main configuration file.
  2. Run a configuration syntax test such as apachectl configtest or httpd -t.
  3. Clear every access log.
  4. Change the server's DNS records.

Question 3: Document roots

A virtual host has DocumentRoot /var/www/example. A client requests https://example.test/images/logo.png. Which filesystem path does Apache generally try first for the requested resource?

  1. /images/logo.png
  2. /var/www/example/images/logo.png
  3. /var/www/example/https/example.test/logo.png
  4. /etc/apache2/images/logo.png

Question 4: Virtual hosting

Which statement best describes name-based virtual hosting?

  1. It requires one physical server for every hostname.
  2. It uses the requested hostname, commonly from the HTTP Host header, to select among sites configured in VirtualHost blocks.
  3. It replaces DNS with filesystem permissions.
  4. It allows only HTTPS sites to share an Apache instance.

Question 5: Modules

Which statement correctly distinguishes enabling an Apache module from configuring its feature?

  1. Enabling a module automatically completes every feature configuration.
  2. A module supplies or extends functionality, but directives and related settings may still be required to use that functionality.
  3. Modules are only used for log rotation.
  4. Modules are separate operating systems loaded by Apache.

Question 6: Access control and authentication

A protected directory must require valid credentials and then allow only approved users. Which statement is correct?

  1. Authentication verifies identity; authorization determines whether access is permitted.
  2. Authentication and authorization both mean selecting a document root.
  3. Authorization verifies identity; authentication selects the virtual host.
  4. Neither process requires directory-level configuration.

Question 7: Logging and status codes

A user reports that a page returns 404 Not Found. Which investigation is most appropriate first?

  1. Inspect the access log and error log, then verify the selected virtual host, URL-to-filesystem mapping, and requested file.
  2. Replace the TLS certificate immediately.
  3. Stop the database server.
  4. Assume that the client browser is the Apache configuration file.

Question 8: Service administration

You have edited a valid Apache configuration and want to apply it while minimizing disruption to active connections. Which sequence is best?

  1. Run a syntax test, then perform a graceful reload such as systemctl reload apache2 or systemctl reload httpd.
  2. Skip validation and stop Apache permanently.
  3. Delete the error log, then start a second Apache instance on the same port.
  4. Restart the operating system before checking the configuration.

Question 9: HTTPS and secure delivery

Which set of configuration elements is most relevant to serving example.test over HTTPS?

  1. <VirtualHost *:443>, ServerName, TLS support, and valid certificate and private-key paths.
  2. Only a DocumentRoot directive on port 80.
  3. Only an access log and a database password.
  4. A browser plugin with no Apache configuration.

Question 10: Integrated troubleshooting

Two domains share one Apache server, but one domain displays the other domain's website. Which cause is most likely?

  1. The server has no filesystem at all.
  2. The ServerName, ServerAlias, or VirtualHost matching is incorrect, so Apache selects a different or default virtual host.
  3. The access log is automatically changing all HTML files.
  4. HTTPS always disables name-based virtual hosting.

Answer Review

Submit or record your answers before reading this section. Then compare each response with the answer and explanation.

1. Correct answer: B

Apache HTTP Server is web server software. It receives HTTP or HTTPS requests and returns content, redirects, errors, or other HTTP responses. A browser is the client, while an operating system, database server, and application code perform different roles.

2. Correct answer: B

A configuration file contains Apache directives, which are instructions and settings. The main configuration file can include additional fragments. A syntax test such as apachectl configtest or httpd -t helps catch errors before a reload or restart.

3. Correct answer: B

DocumentRoot identifies the filesystem directory used for a site's default content. Apache combines that directory with the URL path, so /images/logo.png maps to /var/www/example/images/logo.png in this example.

4. Correct answer: B

A VirtualHost block defines settings for a site or endpoint. ServerName identifies the primary hostname, and ServerAlias adds other hostnames. Apache uses the request's host information to select the matching site, with default virtual-host behavior applying when no suitable match exists.

5. Correct answer: B

A module is a loadable or built-in Apache component that supplies a feature, such as rewriting, TLS, authentication, proxying, or directory indexing. Enabling the module makes its directives available; it does not necessarily configure the feature for a particular site.

6. Correct answer: A

Authentication verifies a user's identity. Authorization decides whether that user, or an unauthenticated client when permitted, may access a resource. Directory-level rules commonly use directives such as AuthType, AuthName, AuthUserFile, and Require.

7. Correct answer: A

An access log records client requests and response details. An error log records warnings, errors, and diagnostic information. A 404 is a client-error status indicating that the requested resource was not found; check the selected virtual host, document root, URL path, file placement, and relevant logs.

8. Correct answer: A

Validate syntax before activating a change. A reload applies configuration without fully stopping the service, and a graceful reload is preferred for many updates because it minimizes disruption to active connections. A restart stops and starts the service and may interrupt connections. Starting launches a stopped service; stopping terminates it.

9. Correct answer: A

HTTPS is HTTP protected by TLS encryption. Apache needs TLS-capable module support, a virtual host listening on port 443, a matching ServerName, and valid certificate and private-key settings such as SSLCertificateFile and SSLCertificateKeyFile.

10. Correct answer: B

The symptom commonly indicates incorrect host-header matching or virtual-host configuration. Check each site's ServerName, ServerAlias, DocumentRoot, enabled configuration, and the default virtual host. Also confirm that DNS sends each hostname to the intended Apache server.

Reference Configurations

Name-based virtual host

<VirtualHost *:80>
    ServerName example.test
    ServerAlias www.example.test
    DocumentRoot /var/www/example
    ErrorLog /var/log/apache2/example-error.log
    CustomLog /var/log/apache2/example-access.log combined
</VirtualHost>

Protected directory

<Directory /var/www/example/private>
    AuthType Basic
    AuthName "Restricted area"
    AuthUserFile /etc/apache2/.htpasswd
    Require valid-user
</Directory>

HTTPS virtual host

<VirtualHost *:443>
    ServerName example.test
    DocumentRoot /var/www/example
    SSLEngine on
    SSLCertificateFile /path/to/certificate.pem
    SSLCertificateKeyFile /path/to/private-key.pem
</VirtualHost>

Common Apache Administration Actions

ActionTypical purposeExpected effectWhen to use it
Configuration testCheck syntaxReports errors without applying a service changeBefore reloads, restarts, or troubleshooting startup failures
StartLaunch a stopped serviceApache begins listening on configured portsWhen the service is not running
Graceful reloadApply configuration changesWorkers finish current work while new configuration is loadedFor many routine configuration updates
RestartStop and start ApacheReinitializes the service and may interrupt connectionsWhen a full restart is required or reload is insufficient
StopTerminate the serviceApache stops serving requestsFor maintenance or controlled shutdown

Useful HTTP Status Codes for Apache Diagnosis

Status codeCategoryTypical meaningLikely investigation area
200SuccessRequest completed successfullyConfirm content and application behavior
301 or 302RedirectionClient should request another locationRedirect directives, HTTPS redirects, and application routing
403Client errorAccess is forbiddenDirectory authorization, filesystem permissions, and access rules
404Client errorRequested resource was not foundDocument root, URL path, file placement, and virtual-host selection
500Server errorUnexpected server-side failureError log, application code, modules, and runtime configuration
503Server errorService temporarily unavailableBackend availability, proxy configuration, and server capacity

Score Interpretation

  • 9–10 correct: You are ready for practical introductory Apache administration tasks.
  • 7–8 correct: Review the missed topics, especially configuration context, virtual hosts, and service operations.
  • 5–6 correct: Revisit document roots, modules, access control, logs, and HTTPS before attempting the quiz again.
  • 0–4 correct: Review the course fundamentals and prerequisites, then retake this self-paced assessment.

For additional practice, see Linux Quiz 1 for related command-line and administration concepts.