Menu

Multiple Server Configuration

Ian Moore
Attachments
phpvbmulti.png (15448 bytes)

Basic Multiple server configuration of phpVirtualBox

Starting with phpVirtualBox 4-0, phpVirtualBox can be configured to interact with multiple VirtualBox installations. Provided that each is running its own vboxwebsrv instance. To do this, edit config.php in phpVirtualBox's folder and locate the following code:

/*
var $servers = array(
    array(
        'name' => 'London',
        'username' => 'user',
        'password' => 'pass',
        'location' => 'http://192.168.1.1:18083/'
    ),
    array(
        'name' => 'New York',
        'username' => 'user2',
        'password' => 'pass2',
        'location' => 'http://192.168.1.2:18083/'
    ),
);
*/

Uncomment the code (remove the /* and */) and edit the server values. An example config may look like this:

var $servers = array(
    array(
        'name' => 'London',
        'username' => 'vbox',
        'password' => 'secret1',
        'location' => 'http://10.32.32.4:18083/'
    ),
    array(
        'name' => 'New York',
        'username' => 'vboxadmin',
        'password' => 'secret2',
        'location' => 'http://10.32.45.2:18083/'
    ),
);

Note that the server names may be anything you wish. These should be descriptive to you.

Once this is done, you may change servers by clicking on the server name in the top item of the virtual machine list. The resulting menu will allow you to specify which server phpVirtualBox will communicate with.

Multiple servers and Authentication

Basic user authentication was introduced in phpVirtualBox 4.0-4. phpVirtualBox stores its usernames and passwords in the VirtualBox server. This can only use ONE VirtualBox server for authentication. By default, it will use the first server in the $servers list. If you would like to change this, you can add an 'authMaster' property set to true to one of the servers. An example my look like:

var $servers = array(
    array(
        'name' => 'London',
        'username' => 'vbox',
        'password' => 'secret1',
        'location' => 'http://10.32.32.4:18083/'
    ),
    array(
        'name' => 'New York',
        'username' => 'vboxadmin',
        'password' => 'secret2',
        'location' => 'http://10.32.45.2:18083/',
                'authMaster' => true
    ),
);

One important implication of this is that phpVirtualBox will only be accessible if the authentication server is up - either the fist one in the list, or the one with the authMaster property. In a bind, you may turn off authentication by adding the following line to config.php:

var $noAuth = true;

Advanced Multiple Server Configuration

Any settings available in phpVirtualBox's config.php can be also be added to a server configuration. E.g.

var $servers = array(
    array(
        'name' => 'London',
        'username' => 'vbox',
        'password' => 'secret1',
        'location' => 'http://10.32.32.4:18083/',
                'consoleHost' => '10.32.32.4',
                'noPreview' => true,
                'browserRestrictFolders' => array('/home/vbox','/mnt/media')

    ),
    array(
        'name' => 'New York',
        'username' => 'vboxadmin',
        'password' => 'secret2',
        'location' => 'http://10.32.45.2:18083/',
                'consoleHost' => '10.32.45.2',
                'browserRestrictFolders' => array('/home/vboxadmin','/var/isos')
    ),
);

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.