Applies To:

All versions of Zend Server Since 6.3

Issue:

There are times when it's necessary to add a virtual host via the CLI.  Here is the process to do that.

Solution:

  1. Use the GUI to create, or get your Web API key under Administration > Web API > Add Key
  2. Enter the command line as follows (please note that individual values will differ)

    /usr/local/zend/bin/zs-manage vhost-add -n magento2 -p 80 -N <API_KEY_NAME> -K <API_KEY_HASH>

  3. The output will look like this after
    vhostInfo 2 magneto2 80 false PendingRestart

Zend Server will need to be restarted for this change to take effect. 

This can also be done from zs-manage by running:

/usr/local/zend/bin/zs-manage restart -N <API_KEY_NAME> -K <API_KEY_HASH>

More information:

https://support.zend.com/hc/en-us/articles/203984146-Quick-Start-For-Using-CLI-Tools-To-Automate-Zend-Server-Single-Cluster-