How To Create Sub Domain In Virtualmin/Webmin

How To Create Sub Domain In Virtualmin/Webmin

Most of the times we need to create sub domains in our accounts. Cpanel provides easy way to create sub domains. But when we talk about creating sub domain in Virtualmin/Webmin, it make us to think how to create sub domains as there is no direct option for creating sub domains.

I heard many people who say virtualmin do not support sub-domains. They are wrong, Virtualmin do supports sub domains as Cpanel do. Some people mix Sub server with the sub domains. Virtualmin has two concepts one is “Sub-Server” and another is “Sub-Domain”. Both are totally different from each other. Sub server is similar to the main server having same features as of server. Like, Emails, databases, DNS zones, scripts, even the administrator options. And a subdomain is a domain that is part of a larger domain.

Sub server has its own document root outside the parent domain and sub domain has its document root inside the parent’s domain document root, same as in cpanel.

Let’s suppose we have a domain “impulsivesolutions.com” and its document root is /home/username/public_html.

Now we want to add sub domain “tutorials.impulsivesolutions.com” under “impulsivesolutions.com”. In case of Sub-server, document root will be “/home/username/domains/ tutorials.impulsivesolutions.com/public_html/” and in case of sub domains it will be “/home/username/public_html/foldername”.

In both case the way of accessing sub domains remains the same i.e  “tutorials.impulsivesolutions.com” the only thing change is its document root nothing else. Performance of the server will remain the same.

According to your requirement you can chose the best method, following the steps to create both sub-server and sub-domain.

Steps To Create Sub Domain in Virtualmin:

  1. Click on the Webmin from the right top.
  2. Click on the servers option at right side bar and select Apache Webserver.
  3. In right panel, click on “create new virtual host”
  4. In Handle connections to address select specific address and IP address you want to associate with sub domain in text field.
  5. In Document Root enter the path of sub-domain like “/home/username/public_html/foldername”
  6. Click on Create Now button.

You are done with creating sub domain, next steps is to create A record for this sub domain. To create A record please follow the following steps:

  1. Again click on Servers option in Webmin and select BIND DNS Server.
  2. Now select the zone of parent domain and click on “Add Record To Selected” button. A new window appears in right panel.
  3. In Record type to add select Address from drop down, in my case it selected by default.
  4. In new Record Name field, enter your subdomain name.
  5. In new record field, enters the IP address
  6. Now click on Add Record button at bottom.

Your sub domain is ready to access now, try accessing it in browser if you are unable to access it please wait for DNS records to update.

Steps To Create Sub-Server in Virtualmin:

  1. In Virtualmin, click on Create virtual Server. In right panel a new window will be loaded.
  2. In Domain name field enters the subdomain address. Address should be complete like “Tutorials.impulsivesolutions.com”
  3. Provide description for sub domain and click on Create Server.

You are all done with creating your Sub-Server. All the DNS records will be automatically created.