Assuming you are talking about configuring an HTTP Server, and that it is Apache, in Debian, VirtualHosts are managed in directory
/etc/www/apache2/sites-available. You create a text file here, with whichever name you want (it is good practice to use the same as the domain you are about to configure).
Lets say you have site1.com. You create the file
/etc/www/apache2/sites-available/site1.com with the following contents:
Options FollowSymLinks MultiViews
allow from all
CustomLog /var/log/apache2/site1.com/access.log combined
The you create a symlink on
/etc/www/apache2/sites-enabled like this:
# cd /etc/www/apache2/sites-enabled
# ln -s ../sites-available/site1.com 000-site1.com
This sets up your first virtual server. If you want to have
site2.com copy this file to another one named after this new domain and change the parameter accordingly:
Create the proper symlink and reload apache (
You will have by default a file
/etc/apache2/sites-available/default which sets the default virtual host for apache. That is solely because it is loaded first as
/etc/apache2/sites-enabled/000-default. It is just another virtual host.
As far as DNS records, you can just point site2.com to the same address to which is pointed site1.com.
There is much more to this configuration options, which you can read at the official Apache HTTP server documentation.
cgi-bin directory is just described as another directive on each virtualhost. Just add to site1.com configuration file something like:
ScriptAlias /cgi-bin/ /some/path/to/site1/cgi-bin
And to site2.com config file:
ScriptAlias /cgi-bin/ /some/path/to/site2/cgi-bin
Or you can even share the same directory for both servers. More on configuring CGI on apache