I have added sub.example.com as a new A record in my DNS manager, and created the virtual host file:
<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName sub.example.com
ServerAlias sub.example.com
DocumentRoot /srv/www/sub.example.com/public_html/
ErrorLog /srv/www/sub.example.com/logs/error.log
CustomLog /srv/www/sub.example.com/logs/access.log combined
</VirtualHost>
At the moment the page just shows the Apache "It Works".
The main site example.com is working with this virtual host:
<VirtualHost *:80>
ServerAdmin webmaster@example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /srv/www/example.com/public_html/
ErrorLog /srv/www/example.com/logs/error.log
CustomLog /srv/www/example.com/logs/access.log combined
</VirtualHost>
Why does sub.example.com not get picked up?