Linux, Web Server & Database

Configure Apache Virtual Host

Set up a correctly configured Apache virtual host for your domain.

The Problem

Apache is installed but your domain either shows the default page, the wrong site, or an error — because the virtual host for your specific domain isn't set up correctly, or the site hasn't been enabled.

About this problem

Apache uses virtual hosts to decide which site to serve for a given domain, and a common gap is creating the virtual host file but forgetting to enable it with a2ensite, or getting the ServerName/DocumentRoot mismatched against where the actual files live.

This comes up constantly when adding a new domain to a server that already hosts other sites, or when following outdated instructions that don't match the current Apache version's layout.

What's Included

What's NOT Included

How It Works

  1. Create a virtual host file with the correct ServerName and DocumentRoot.
  2. Set Directory permissions and AllowOverride as the application requires.
  3. Enable the site with a2ensite and disable any conflicting default site if necessary.
  4. Test the configuration with apachectl configtest before reloading.
  5. Verify the domain serves the correct content and other existing sites remain unaffected.

In practice: you buy the service, send over whatever access or details the job needs, I investigate and do the work, and you confirm it's resolved before we call it done.

Frequently Asked Questions

Why isn't my new Apache site showing up?
Most commonly the virtual host file was created but never enabled with a2ensite, or Apache was never reloaded after the change — both are easy to forget.
What's the difference between sites-available and sites-enabled?
sites-available holds all virtual host config files whether active or not; sites-enabled contains symlinks to the ones actually active — a2ensite creates that symlink for you.
Can I run multiple domains on the same Apache server?
Yes, each with its own virtual host block specifying a unique ServerName and DocumentRoot, all served from the same Apache instance.
Why do I get a 403 Forbidden error on my new virtual host?
Usually a permissions issue on the DocumentRoot directory, or a Directory block in the virtual host that doesn't grant the access the application needs.
Do I need to restart or reload Apache after adding a virtual host?
A reload is sufficient and doesn't drop active connections, whereas a full restart briefly stops the service — reload is preferred unless a specific change requires a restart.
How do I check which virtual host is actually being used for a domain?
apachectl -S lists all configured virtual hosts and which one matches each ServerName, useful for spotting conflicts between multiple sites.
Please note: the price shown applies to a standard case matching the description above. Every situation is different, and if your request falls outside the normal scope of this service, I will explain this before doing any additional chargeable work. I will never silently turn a small job into an expensive project.
Running into an issue with a service you've already bought, or unsure which one fits your problem? Message me directly on WhatsApp — no ticket system, no bot.