The subdomain utility is used to manage subdomains through CLI. By using this utility, you can perform the following tasks:

  • creating, renaming, and removing subdomains
  • displaying information about subdomain configuration
  • managing domain hosting parameters such as support of various scripting languages, log settings, hard disk limits, and SSL/TLS support
  • managing FTP user account for subdomains

Usage

subdomain <command> <subdomain_name> [
<option_1> [<param>]
[<option_2> [<param>]]
... [<option_N> [<param>]]

Example

The following command creates subdomain sample.example.com on the domain example.com, sets the disk space quota for the subdomain to 1 GB, enables support for SSI, PHP, and SSL/TLS.

plesk bin subdomain --create subdomain -domain example.com -hard_quota 1G -ssi true -php true -ssl true

Commands

Command Parameter Description Example
--create or -c <subdomain_name>

Creates a subdomain on a specified domain.

Required -domain option.

Use the asterisk (*) symbol to create a wildcard subdomain. Site visitors will be redirected to this subdomain regardless of the subdomain name they enter in a browser.

To create the subdomain sample on the domain example.com:

plesk bin subdomain --create sample -domain example.com

or

plesk bin subdomain -c sample -domain example.com

--update or -u <subdomain_name>

Updates an existing subdomain.

Required -domain option.

To rename the subdomain from sample.example.com to forum.example.com:

plesk bin subdomain --update sample -domain example.com -new_name forum

or

plesk bin subdomain -u sample -domain example.com -new_name forum

--remove or -r <subdomain_name>

Removes one or more specified subdomains from a specified domain.

Required -domain and -subdomain options.

To remove subdomains sample.example.com and forum.example.com from the domain example.com:

plesk bin subdomain --remove -subdomains sample,forum -domain example.com

or

plesk bin subdomain -r -subdomains sample,forum -domain example.com

--info or -i <subdomain_name> Displays information on configuration of a specified subdomain.

To view information about a subdomain sample.example.com:

plesk bin subdomain --info sample.example.com

or

plesk bin subdomain -i sample.example.com

--suspend   Suspends the subdomain.

To suspend subdomains sample.example.com and forum.example.com from the domain example.com:

plesk bin subdomain --suspend -subdomains sample,forum -domain example.com

--help or -h   Displays help on the use of the utility.

To view the help info on the use of this utility:

plesk bin subdomain --help

or

plesk bin subdomain -h

--list or -l   Displays the list of domains.

To see the list of all domains on the server:

plesk bin subdomain -l

Options

Option Parameter Description Example
-domain or -d <domain_name> Specifies the parent domain to which the subdomain belongs.

To create a subdomain on example.com:

plesk bin subdomain -c subdom -domain example.com

-new_name <subdomain_name>

Renames a subdomain.

Used with the --update command only.

To rename the subdomain from sample.example.com to forum.example.com:

plesk bin subdomain -u subdom -domain example.com -new_name forum

-http_code 301|302 Specifies the HTTP response status code to be used for standard forwarding.

To use the 302 code for forwarding on the subdomain sample.example.com, which has the standard forwarding type of hosting:

plesk bin subscription -u sample.example.com -http_code 302

-mail-service-ip <IP address>[,<IP address>,..] Sets list of IPv4 and IPv6 addresses for the mail service.

To set the mail service IP for the subdomain sample.example.com to 192.168.1.2:

plesk bin subdomain -u sample -domain example.com -mail-service-ip 192.168.1.2

-www-root <www_root> Specifies the document root directory for a subdomain, relative to the subscription root directory.

To specify the directory /site2 as the root directory for the subdomain sample.example.com:

plesk bin subdomain --create sample -domain example.com -www-root /site2

-ssi true|false

Enables/Disables SSI support.

Is false by default.

To enable SSI support on the subdomain forum.example.com:

plesk bin subdomain -u forum -domain example.com -ssi true

-php true|false

Enables/Disables PHP support.

Is false by default.

To enable PHP support on the subdomain sample.example.com:

plesk bin subdomain -u sample -domain example.com -php true

-cgi true|false

Enables/Disables CGI support.

Is false by default.

To enable CGI support on the subdomain sample.example.com:

plesk bin subdomain -u sample -domain example.com -cgi true

-fastcgi true|false

Enables/Disables FastCGI support.

Is false by default.

To enable FastCGI support on subdomain sample.example.com:

plesk bin subdomain -u sample -domain example.com -fastcgi true

-perl true|false

Enables/Disables Perl support.

Is false by default.

To enable Perl support on the subdomain sample.example.com:

plesk bin subdomain -u sample -domain example.com -perl true

-asp true|false

Enables/Disables ASP support.

Is false by default.

To enable ASP support on the subdomain sample.example.com:

plesk bin subdomain -u sample -domain example.com -asp true

-python true|false

Enables/Disables Python support.

Is false by default.

To enable Python support on the subdomain sample.example.com:

plesk bin subdomain -u sample -domain example.com -python true

-subdomains or -s <subdomain_name>[,<subdomain_name>,...]>

Specifies the subdomains to remove or to display information about.

Is used in combination with --remove and --info commands, respectively.

To remove subdomains sample.example.com and forum.example.com from the domain example.com:

plesk bin subdomain --remove -subdomains sample,forum -domain example.com

-ssl true|false

Enables/Disables SSL/TLS support.

Set to false by default.

To enable SSL/TLS support on the subdomain sample.example.com:

plesk bin subdomain -u sample -domain example.com -ssl true

-ssl-redirect true|false

Enables/Disables SEO-safe 301 redirection from HTTP to HTTPS.

Is false by default.

To enable redirection from HTTP to HTTPS on the subdomain sub1.example.com:

plesk bin subdomain -u sub1.example.com -ssl-redirect true

-certificate-name <certificate-name>

Specifies the name of SSL/TLS certificate assigned to subdomain if SNi is supported.

SNI is supported on the following operating systems:

  • OpenSuSe 11.3 or later
  • Ubuntu 10.4 or later
  • Debian 7.0 or later
  • RedHat 6 or later

To assign SSL/TLS certificate named New Certificate to the subdomain sample.example.com:

plesk bin subdomain -u sample -domain example.com -certificate-name "New Certificate"

-notify true|false

Allows/Prohibits standard email notifications on a subdomain creation (Plesk domain administrators and clients).

Used with --create only.

To prevent email notifications about the subdomain creation:

plesk bin subdomain --create sample.example.com -notify false

-max-connections <number>

Limits the number of HTTP connections.

Unlimited is set to -1.

To limit the maximum number of connections available for the subdomain sample.example.com to 10:

plesk bin subdomain -u sample.example.com -max-connections 10

-traffic-bandwidth <number>

Limits the network usage.

Unlimited is set to -1.

To limit the maximum network use on the subdomain sample.example.com to 500 KB/S:

plesk bin subdomain -u example.com -traffic-bandwidth 500

-php_handler_id cgi|fastcgi|module Associates a PHP handler with the site. Specify the handler’s identifier (default: cgi).

To set PHP handler on the subdomain to FastCGI:

plesk bin subdomain -u sample.example.com -php_handler_id fastcgi

-seo-redirect non-www|www|none Turns on the search engine friendly HTTP 301 redirection. Use ‘non-www’ to redirect from www.domain to domain, ‘www’ to redirect from domain to www.domain, and ‘none’ to turn off the redirection (default: non-www).

To turn on redirection for the subdomain sample.example.com to www.sample.example.com:

plesk bin subdomain -u sample.example.com -seo-redirect www

-description <string> Sets a description for the subscription to be displayed in Plesk.

To set a description reading “Custom description” for the subdomain sample.example.com:

plesk bin subdomain -u sample -domain example.com -description "Custom description"

-admin-description <string> Sets a description for the subscription to be displayed in Plesk to the Administrator.

To set a description reading “Custom description” for the subdomain sample.example.com:

plesk bin subdomain -u sample -domain example.com -admin-description "Custom description"

-reseller-description <string> Sets a description for the subscription to be displayed in Plesk to be displayed to a Reseller and the Administrator.

To set a description reading “Custom description” for the subdomain sample.example.com:

plesk bin subdomain -u sample -domain example.com -reseller-description "Custom description"

-empty-document-root true|false Creates a subdomain with empty document root directory (skip promo pages creation).

To create a subdomain with empty document root:

plesk bin subdomain -c sample.example.com -hosting true -login login -passwd setup -ip 10.52.76.142 -empty-document-root true