I am trying to use the command line to create new virtual servers. I have no problem running a command like this:
virtualmin create-domain --domain example.com --pass password --template "mydefault" --features-from-plan
But as soon as I try to add a server alias I get different errors depending on whether I add the alias on the initial create command or whether I run the command after the domain has been created.
If I run this command with the alias during the original create script I get the error below
virtualmin create-domain --domain example.com --pass password --alias example.net --template "mydefault" --features-from-plan
Parent domain does not exist
However, if I create the domain 1st and then try to add the alias I get the following error:
virtualmin create-domain --domain example.com --alias example.net You are already hosting this domain
Creating aliases works fine through the GUI, so I'm guessing there's a bug or the documentation is not explaining the syntax properly. Could someone please provide some assistance for what the correct syntax should be to create a alias or determine whether this is in fact a bug.
The documentation says the following about creating an alias. It is vague, but I can't see another way to write the great script other than what I've tried (and I've tried numerous other combinations not listed here).
To create an alias of an existing virtual server, use the --alias option, followed by the domain name of the target server. For alias servers, the --pass , --unix , --webmin , --dir and --quota options are not needed.
Thanks,
Hrm, I ran into the same problem you did while testing this out... it would seem we're both reversing the parameters :-)
The --domain parameter should be the alias (example.net).
The --alias parameter is what it's an alias of (example.com).
And then, you'd also want to pass in some Virtual Server features to enable in your alias, such as --web and perhaps --dns.
-Eric
Beautiful! Thanks!
I might suggest a clarification and example in the documentation.
virtualmin create-domain --domain example.net --alias example.com --template "default" --features-from-plan
Beginning server creation ..
Creating home directory .. .. done
Adding to email domains list .. .. done
Updating target virtual website .. .. done
Performing other Apache configuration .. .. done
Applying web server configuration .. .. done
Saving server details .. .. done
Configuring AWstats in example.com .. .. done
All done!