Sorted it out. Posting here in case anybody else has the same problem.
I copied /var/cpanel/templates/apache2/main.default to /var/cpanel/templates/apache2/main.local and edited the new copy, main.local.
I found the following lines.
Code:
[%- FOREACH nvh IN namevirtualhosts -%]
NameVirtualHost [% nvh %]
[% END -%]
NameVirtualHost *
After these lines, I added the following, replacing myip with the dedicated IP address and /some/folder with a nonexistent folder (as I want a 404 if anyone access the site other than through the proper domain name):
Code:
<VirtualHost myip:80>
DocumentRoot /some/folder
</VirtualHost>
I then ran the following commands to rebuild the apache config and restart the server.
Code:
/usr/local/cpanel/scripts/rebuildhttpdconf
/usr/local/cpanel/scripts/restartsrv_apache
Seems to work, though it seems a shame to have to copy the main template to do something so simple. Perhaps someone knows a better way...?