>.>
You seem to be confusing IP-based virtualhosts with name-based virtualhosts... which happens often, for they're counterintuitive.
IP-based vhosts:
Code:
<VirtualHost 1.1.1.1:80>
ServerAdmin myemail@address.com
ServerName example.com
ServerAlias www.example.com
# DocumentRoot, logs, whatever
</VirtualHost>
<VirtualHost 2.2.2.2:80>
ServerAdmin myemail@address.com
ServerName sub.example.com
ServerAlias www.sub.example.com
# DocumentRoot, logs, whatever
</VirtualHost>
Name-based vhosts
Code:
NameVirtualHost *:80
<VirtualHost *:80>
# First namevhost for this IP(or wildcard), will be selected
# if the user agent did not supplied Host: header
ServerAdmin myemail@address.com
ServerName example.com
ServerAlias www.example.com
# DocumentRoot, logs, whatever
</VirtualHost>
<VirtualHost *:80>
ServerAdmin myemail@address.com
ServerName sub.example.com
ServerAlias www.sub.example.com
# DocumentRoot, logs, whatever
</VirtualHost>
Or, instead of *:80 you can specify one, and the same IP for a name vhost group, so you can have some namevhosts at one IP, and others at other. Matching there is done one the ServerName and ServerAlias lines.