Automate virtual server creation

I’d like to have a php script of mine create a new virtual server on my server running Virtualmin so I need it to create the server for a new domain in apache, create an FTP and MySQL user and assign a password, create a MySQL database etc. - basically the things Virtualmin does when you go create a new virtual server through Virtualmin.

I’m looking for some advice on the best way of doing this - is there a way of running a script through Virtualmin to do this or should I have my script actually do everything directly (i.e. edit the Apache configuration, add a user, create a MySQL database) outside of Virtualmin?

Thanks for any advice.


It sounds like what you want is the Virtualmin API. You can read about that here:

That looks exactly like what I’m looking for!