Apache HTTP Server course

Virtual hosts

Serve two sites from one Apache process.

A virtual host is a block of directives that apply to one hostname or IP. Name-based vhosts share an address and split on the Host header.

<VirtualHost *:80>
    ServerName lab.example
    DocumentRoot /var/www/lab
    ErrorLog ${APACHE_LOG_DIR}/lab-error.log
    CustomLog ${APACHE_LOG_DIR}/lab-access.log combined
</VirtualHost>

On Debian, drop that file in sites-available, run a2ensite, and reload. Point DNS or your hosts file at the box before you wonder why you still see the default page.