Difference between revisions of "Server Port Overrides"

From WHMCS Documentation

(Created page with "thumb|Server Port configuration To override the port that a server in WHMCS will use, is quite simple. When adding a server, check the 'Override with...")
 
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[File:server_port.png|thumb|Server Port configuration]]
+
Many server modules allow you to customise the port number that is used for connections via the server configuration. This is useful for situations where you customise the port a service is operating on.
To override the port that a server in WHMCS will use, is quite simple. When adding a server, check the 'Override with Custom Port' checkbox that can be seen next to the existing port number. Once checked, you can then amend the value as you wish. Unchecking the box will reset the value to the default defined for that server. All supported modules that use this option are defined in the Default Server Ports table below.
 
  
===Use in Development===
+
== The Port Field ==
To use an overridable port in your custom server module, you need to define the default(s) within the MetaData function.<br />
+
If a module supports it, a '''Port''' field will appear when configuring a server.  If you do not see this field, the module you are using does not support port customisation.
The sample here provides a custom module with a default port of 80 and an SSL port of 443.
+
 
<source lang="php">
+
[[File:Server-config-port-override84.png]]
function template_MetaData()
+
 
{
+
Check '''Override with Custom Port''' for the existing port number and then customise the port value. Unchecking the box will reset the value to the default for the server. See the table below for a list of supported modules that use this option:
    return array(
 
        'DisplayName' => 'Server Module Display Name',
 
        'DefaultNonSSLPort' => '80',
 
        'DefaultSSLPort' => '443',
 
    );
 
}
 
function template_CreateAccount($params)
 
{
 
    $serverPort = $params['serverport'];
 
}
 
</source>
 
  
 
===Default Server Ports===
 
===Default Server Ports===
Line 49: Line 37:
 
|XPanel||80||3737
 
|XPanel||80||3737
 
|}
 
|}
 +
 +
===Use in Development===
 +
 +
To add support for port customisation to your server or provisioning modules, define the defaults within the <tt>MetaData</tt> function.
 +
 +
The following example provides a custom module with a default port of 80 and an SSL port of 443:
 +
 +
<source lang="php">
 +
function template_MetaData()
 +
{
 +
    return array(
 +
        'DisplayName' => 'Server Module Display Name',
 +
        'DefaultNonSSLPort' => '80',
 +
        'DefaultSSLPort' => '443',
 +
    );
 +
}
 +
 +
function template_CreateAccount($params)
 +
{
 +
    $serverPort = $params['serverport'];
 +
}
 +
</source>

Latest revision as of 20:21, 3 May 2022

Many server modules allow you to customise the port number that is used for connections via the server configuration. This is useful for situations where you customise the port a service is operating on.

The Port Field

If a module supports it, a Port field will appear when configuring a server. If you do not see this field, the module you are using does not support port customisation.

Server-config-port-override84.png

Check Override with Custom Port for the existing port number and then customise the port value. Unchecking the box will reset the value to the default for the server. See the table below for a list of supported modules that use this option:

Default Server Ports

Module Name Standard Port SSL Port
cPanel 2086 2087
DirectAdmin 2222 2222
Enkompass 2086 2087
Helm 4 8086 -
HyperVM 8888 8887
Interworx - 2443
LXAdmin 7778 7777
SCPanel 2086 2087
vePortal 2407 2408
WHMSonic 2086 2087
XPanel 80 3737

Use in Development

To add support for port customisation to your server or provisioning modules, define the defaults within the MetaData function.

The following example provides a custom module with a default port of 80 and an SSL port of 443:

function template_MetaData()
{
    return array(
        'DisplayName' => 'Server Module Display Name',
        'DefaultNonSSLPort' => '80',
        'DefaultSSLPort' => '443',
    );
}

function template_CreateAccount($params)
{
    $serverPort = $params['serverport'];
}