The ISPmanager control panel allows you to automatically create subdomains for an existing domain.

Using this feature, users can automatically create third-level domains in their domain without having to make changes in the configuration, thereby using automatic subdomains frees them from additional operations.

Subdomains are created by creating directories in the appropriate directories, the directory name depends on the settings

Enabling autodomains in the ISPmanager panel

To enable auto subdomains in ISPmanager, go to the WWW domains menu and then select the Auto subdomains option in the properties of the selected WWW domain:

"In a separate directory" - subdomain files will not be available from the main domain, you should create them in folders corresponding to the name of the subdomain in the owner user's home directory in the www directory, for example:

the domain example.com is located in the folder www/example.com
there is a need to create a domain.example.com

For such a configuration to work, the subdomain files need to be placed in the www/domain.example.com directory

"In the subdirectory of the WWW domain" - subdomain files will be available from the main domain, you need to create them in folders corresponding to the name of the subdomain in the home directory of the owner user in the directory www/example.com, for example

the domain example.com is located in the folder www/example.com
there is a need to create a domain.example.com

For such a configuration to work, you will need to place the subdomain files in the www/example.com/domain directory. In this case the data will also be available at example.com/domain

Technical details of auto subdomains

To use automatic subdomains, the Apache web server module mod_vhost_alias is used

To make auto subdomains available in the menu of ISPmanager, you need to have it enabled in your configuration, or you can use ForceAutoSubdomain option in your control panel configuration file.

When you enable auto-subdomain through ISPmanager, the following entries will be added to the configuration of the corresponding virtual host

VirtualDocumentRoot /home/username/data/www/%0 for subdomains "in a separate directory" or

VirtualDocumentRoot /home/username/data/www/example.com/%1 For operation of subdomains "in a subdirectory of WWW domain"

Also entered wildcard record *.example.com in the directive ServerAlias and record * type A in the DNS configuration for the selected domain, pointing to the IP address of the domain.

This ensures that they work

Frequent questions arising when working with autodomains

*In which directory should auto subdomain files be placed?

This depends on the selection of auto subdomain mode. The files should be placed in the folder either www/full.domain.name, or in the folder www/domain.name/name

Autodomains do not work after enabling, the domain is not available in DNS

You will need some time to update the DNS cache (up to 24-48 hours). You will also need to have the domain delegated to the same name servers used in ISPmanager.

When auto subdomains are enabled, other subdomains for this domain stop working, giving an "error 404"*

After you enable an auto subdomain, you will have to add *.example.com record in the apache configuration for the selected domain, and, accordingly, all requests go to this domain. To solve this problem, you can write in the field Alias only those records that are needed.

DNS entries pointing to other IP addresses will no longer work*

Wildcard record * in DNS configuration (in Domain Names menu) has a higher priority than other records. In this case, you should either do not use autodomains or manually add all A records to DNS. This effect may not always occur.

The domain (subdomain) with the entry (with the prefix) www. (i.e. www.example.com or www.domain.example.com)*

For such domains to work, symbolic links (symlinks) must be created in the configuration-dependent directory, for example:

In case "In a separate directory" configuration is used, the symlink must exist in the www directory, for example:

lrwxr-xr-x 1 root user 13 25 Sep 22:32 www.example.com -> example.com
lrwxr-xr-x 1 root user 13 25 Sep 22:32 www.domain.example.com -> domain.example.com

If the configuration is "in a subdirectory of the WWW domain", the symbolic link must be in the directory where the domain is located and look like

lrwxr-xr-x 1 root user 13 25 Sep 22:32 www -> .
lrwxr-xr-x 1 root user 13 25 Sep 22:32 www.domain -> domain

**How do I create a symlink?

To create a symlink, use the shell command ln -s, for example:

# ln -s domain www.domain
# ln -s . www

This will create symlinks with www prefix from the specified directory.

Updated Aug. 14, 2018