How do I manage domains and subdomains in cPanel on my VPS?
Managing domains and subdomains in cPanel on your VPS is straightforward. Here’s a step-by-step guide to help you handle domains and subdomains using cPanel:
### **1. Access cPanel**
1. **Log In to cPanel:**
- Open your web browser and go to `http://yourdomain.com/cpanel` or `http://your-server-ip:2083`.
- Enter your cPanel username and password to log in.
### **2. Manage Domains**
#### **Add a New Domain**
1. **Navigate to the Domains Section:**
- Look for the "Domains" section on the cPanel home page.
- Click on **"Addon Domains"**.
2. **Add Domain:**
- **New Domain Name:** Enter the domain name you want to add (e.g., `example.com`).
- **Subdomain/FTP Username:** cPanel will automatically suggest a subdomain and directory for the new domain. You can change these if needed.
- **Document Root:** This is the directory where files for the new domain will be stored. It defaults to something like `/public_html/example.com`, but you can change it.
- **Password:** Set a password for the FTP account associated with this domain, if desired.
- Click **"Add Domain"**.
3. **DNS Configuration:**
- Ensure that the DNS records for your new domain are correctly set up with your domain registrar or DNS provider. You need to point the domain to your VPS’s IP address.
#### **Manage Existing Domains**
1. **Navigate to the Domains Section:**
- Go to **"Addon Domains"** or **"Domains"** depending on what you need to manage.
2. **Edit or Remove Domains:**
- **Edit:** You can change the document root or FTP username for existing addon domains.
- **Remove:** To delete a domain, click on **"Remove"** next to the domain name you want to remove. Be cautious as this will delete the domain’s associated files and settings.
### **3. Manage Subdomains**
#### **Add a New Subdomain**
1. **Navigate to the Subdomains Section:**
- Go to the **"Subdomains"** section under "Domains" on the cPanel home page.
2. **Create Subdomain:**
- **Subdomain:** Enter the name of the subdomain (e.g., `blog` if you want `blog.example.com`).
- **Domain:** Select the domain to which you want to add the subdomain.
- **Document Root:** This is where files for the subdomain will be stored, typically something like `/public_html/blog`.
- Click **"Create"**.
#### **Manage Existing Subdomains**
1. **Navigate to the Subdomains Section:**
- Go to **"Subdomains"**.
2. **Edit or Remove Subdomains:**
- **Edit:** Change the document root or rename the subdomain.
- **Remove:** To delete a subdomain, click **"Remove"** next to the subdomain name. Be careful as this will delete the subdomain’s associated files.
### **4. DNS Management**
- **DNS Zone Editor:**
- Go to the **"Zone Editor"** under the "Domains" section.
- **Add/Edit Records:** Manage DNS records such as A records, CNAME records, MX records, etc. This is useful for setting up email or additional subdomains.
### **5. SSL Certificates**
1. **Navigate to SSL/TLS:**
- Go to **"SSL/TLS"** under the "Security" section.
2. **Install SSL Certificates:**
- **Install an SSL Certificate:** Select the domain or subdomain, and follow the prompts to install an SSL certificate if one is available or if you need to purchase one.
### **Summary**
1. **Access cPanel:** Log in via `http://yourdomain.com/cpanel`.
2. **Manage Domains:**
- **Add Domain:** Use **"Addon Domains"** to add new domains.
- **Edit/Remove Domain:** Manage existing domains under **"Addon Domains"**.
3. **Manage Subdomains:**
- **Add Subdomain:** Use **"Subdomains"** to create new subdomains.
- **Edit/Remove Subdomain:** Manage subdomains under **"Subdomains"**.
4. **DNS Management:** Use **"Zone Editor"** to handle DNS records.
5. **SSL Certificates:** Install and manage SSL certificates via **"SSL/TLS"**.
By following these steps, you can effectively manage both your primary and secondary domains as well as subdomains in cPanel on your VPS.