cPanel
3d ago
5 views
4 min read
How to create a subdomain in cPanel
Learn to add a subdomain like mail.example.com to your cPanel account in under five minutes using the built-in interface.
Roy S
Updated 20h ago
You will add a subdomain to your existing cPanel account and configure its DNS records. These steps apply to cPanel 118.x and newer versions running on Linux or Windows. You will create a subdomain for email, web traffic, or file storage without needing root access.
Prerequisites
- Access to a cPanel/WHM account (cPanel 118.x or newer).
- A domain name already added to your account.
- A web browser and a stable internet connection.
- Basic knowledge of DNS records (A, CNAME, MX).
Step 1: Log into cPanel
Open your web browser and navigate to your domain's cPanel login page. Enter your username and password to access the dashboard. You will see the main control panel with icons for domains, files, and email. Click the Domains icon in the left sidebar or search bar.Step 2: Add the subdomain
Locate the Add a Domain or Subdomains section on the Domains page. Click the Add a Domain button. In the Subdomain field, type the name you want, such asmail. In the Domain field, enter your main domain, such as example.com. Ensure the Document Root field is set to /home/username/subdomain. Click Create to finalize the addition. The system will create the necessary directories and files.
Step 3: Configure DNS records
Navigate to the Zone Editor or DNS Zone Editor section in the left sidebar. Click Manage next to your main domain. Scroll down to the Subdomains section and click Add a subdomain. Enter the subdomain name again, such asmail. Select the IP Address or Nameserver type. Choose A Record and enter the IP address of your web server or the IP provided by your host. Click Add Record. The DNS record will appear in the list. Wait for DNS propagation, which usually takes 15 to 60 minutes.
Step 4: Set up email for the subdomain (optional)
If you need email for the subdomain, go to the Email section in the left sidebar. Click Email Accounts. Enter a username, such asadmin, and a password. Select the subdomain from the Domain dropdown menu. Click Create. You will see the account listed under Subdomains. Set the quota to Unlimited or a specific limit like 100 MB. Click Save.
Step 5: Configure SSL for the subdomain
Go to the SSL/TLS section in the left sidebar. Click SSL/TLS Status. Find your subdomain in the list. Click Install next to the subdomain. Select Let's Encrypt as the provider. Click Install to generate the certificate. The system will validate the domain and install the certificate. You will see a green lock icon next to the subdomain in the browser.Verify the installation
Open your web browser and navigate tohttps://mail.example.com. You should see the default cPanel welcome page or your site's root index file. If you set up email, send a test email to admin@mail.example.com and check the inbox. The browser address bar should show a valid SSL certificate issued by Let's Encrypt.
Troubleshooting
- Error: "Subdomain already exists"
This happens if you tried to create a subdomain with the same name as an existing one. Check the Subdomains list in the Domains section. Delete the old entry or choose a different name. Ensure you are not using a reserved name likewwworftp. - Error: "DNS propagation failed"
The subdomain does not resolve immediately. Wait 15 to 60 minutes. Use a tool likedig mail.example.comornslookup mail.example.comto check if the A record is visible. If it is not visible, contact your hosting provider to check the nameservers. - Error: "SSL certificate installation failed"
This occurs if the domain is not verified. Ensure the subdomain points to the correct IP address. Check that the domain is not blocked by a firewall. Try installing the certificate again after waiting 10 minutes. - Error: "Email not sending"
Check the Email Delivery logs in the Email section. Ensure the subdomain is not using a different MX record. Verify that the email quota is not exceeded. Reset the password if you suspect a login issue. - Error: "403 Forbidden"
This means the directory is not accessible. Check the Directory Listing permission in the Files section. Ensure the.htaccessfile does not block access. Set the directory permissions to755for the subdomain folder.
Tags:
cPanelsslDNSWebmail
0
Was this helpful?