πŸ“– ~1 min read

Table of contents
  1. Symptom & Impact
  2. Environment & Reproduction
  3. Root Cause Analysis
  4. Quick Triage
  5. Step-by-Step Diagnosis
  6. Solution – Primary Fix
  7. Solution – Alternative Approaches
  8. Verification & Acceptance Criteria
  9. Rollback Plan
  10. Prevention & Hardening
  11. Related Errors & Cross-Refs
  12. References & Further Reading

Symptom & Impact

Requests serve the wrong website or default page, breaking routing and SSL host expectations.

Environment & Reproduction

Ubuntu 16.04 apache2 with multiple vhosts and duplicated ServerName/ServerAlias entries. Reproduce by enabling conflicting site configs.

Root Cause Analysis

Apache selects an unintended virtual host due to configuration precedence, duplicate names, or missing NameVirtualHost-era migration cleanup.

Quick Triage

Run apache2ctl -S and inspect /etc/apache2/sites-enabled symlinks. Validate syntax with apache2ctl configtest.

Step-by-Step Diagnosis

Review each vhost file for ServerName uniqueness, port bindings, SSL cert paths, and include order interaction with 000-default.

Illustrative mockup for ubuntu-16-04-lts β€” ubuntu1604-b01-p19-diagnosis
apache2ctl -S reveals wrong vhost mapping β€” Illustrative mockup β€” Progressive Robot

Solution – Primary Fix

Set explicit unique ServerName values, disable conflicting sites with a2dissite, enable correct site with a2ensite, then systemctl reload apache2.

Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.

Illustrative mockup for ubuntu-16-04-lts β€” ubuntu1604-b01-p19-fix
site enabled order corrected and reload successful β€” Illustrative mockup β€” Progressive Robot

Solution – Alternative Approaches

Migrate front-end routing to nginx reverse proxy, keeping Apache as backend app server where operationally simpler.

Verification & Acceptance Criteria

Host header tests return expected site content and certificates for all configured domains.

Rollback Plan

Re-enable previously active site symlinks and restore backed-up vhost files, then reload Apache.

Prevention & Hardening

Adopt naming conventions and CI lint checks for vhost uniqueness. Keep site enable/disable actions under change control.

Related to Let’s Encrypt challenge failures, 403 on DocumentRoot, and PHP-FPM backend socket errors.

Related tutorial: View the step-by-step tutorial for Ubuntu 16.04 LTS.

View all Ubuntu 16.04 LTS tutorials on the Tutorials Hub β†’

Browse all common problems & solutions on the Tutorials Hub.

References & Further Reading

Apache VirtualHost docs, apache2ctl usage, and web stack configuration standards.

Need Expert Help?

If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today β€” we respond within one business day.