cpanel如何创建帐户?

Say I don't want cpanel to create websites/accounts on a server. Is there a way to create them programmatically, like in nodejs or PHP ? How does cpanel do it?

I know that websites are created by modifying the apache config files, but how to add accounts and link them to websites?

cPanel and other control panels aren't very simple to explain in a single StackOverflow question in my opinion.

Trying to put it simpler, it consists in a process of:

  1. creating a user on the operating system;
  2. creating the skeleton folders;
  3. assigning the right permissions;
  4. assigning the right account limits;
  5. creating a virtual host in apache;
  6. configuring internal dns entries;
  7. creating a user in its database so they can login later;
  8. send confirmation emails about account creation;

These are some basic steps required to make a system like cPanel add a new account. There are probably many more that I'm not thinking of.