How to install WordPress on a subdomain in cPanel

Home / Servers / How to install WordPress on a subdomain in cPanel

Setting up WordPress on a subdomain can be a great way to create a separate section of your website, such as a blog or a forum, without affecting the main site. In this guide, I’ll walk you through the steps to install WordPress on a subdomain using cPanel, which is a widely used control panel for managing hosting environments. By the end of this post, you’ll have WordPress up and running on your subdomain, ready for customization.

What is a subdomain?

Before diving into the steps, let’s clarify what a subdomain is. A subdomain is an extension of your main domain, allowing you to create independent sections of your website. For example, if your main domain is example.com, a subdomain could be blog.example.com or store.example.com. This can be useful for separating different areas of your site while keeping them under the same domain umbrella.

Step 1: Creating a subdomain in cPanel

To begin, you need to create the subdomain where WordPress will be installed. Here’s how to do it:

  1. Log in to your cPanel account: Access your hosting provider’s cPanel. You can usually do this by visiting yourdomain.com/cpanel.
  2. Find the Subdomains section: Once in cPanel, look for the “Subdomains” option under the “Domains” section.
  3. Create your subdomain:
  • In the Subdomains interface, enter the name you want for your subdomain (e.g., blog, store, etc.).
  • Choose the domain you want to attach the subdomain to if you have multiple domains.
  • cPanel will automatically generate a root directory for the subdomain, usually public_html/subdomainname. You can leave this as is or specify a different folder if needed.
  • Click Create.

After creating the subdomain, it will appear in the list of available subdomains.

Step 2: Installing WordPress on the subdomain

Now that the subdomain is ready, you can install WordPress on it. There are two common methods to do this in cPanel: using a one-click installer or manually installing WordPress.

Method 1: Using Softaculous or a one-click installer

Most hosting providers offer one-click installation tools like Softaculous, which simplify the process of installing WordPress. Here’s how to install WordPress on a subdomain in cPanel using Softaculous:

  1. Access Softaculous: In your cPanel, scroll down to the “Software” section and click on the “Softaculous Apps Installer” or “WordPress” icon.
  2. Choose WordPress installation: Once inside Softaculous, select WordPress from the list of available applications.
  3. Select your subdomain:
  • In the installation screen, you’ll need to choose the domain where WordPress will be installed. Select your newly created subdomain from the drop-down menu.
  • Ensure that the directory field is empty if you want WordPress to be installed directly on the subdomain and not in a subdirectory (e.g., blog.example.com, not blog.example.com/wp).
  1. Configure site settings: Enter a site name, description, and admin login details (username, password, and email). Be sure to set a strong password for security.
  2. Complete the installation: After reviewing your settings, click Install. Softaculous will handle the rest, and you’ll be able to log in to your WordPress site within a few minutes.

Method 2: Manual installation of WordPress

If you prefer to install WordPress manually, you can do so by following these steps:

  1. Download WordPress: Go to wordpress.org and download the latest version of WordPress.
  2. Upload the WordPress files:
  • In cPanel, open the “File Manager” under the “Files” section.
  • Navigate to the root directory of your subdomain (e.g., public_html/blog).
  • Upload the WordPress ZIP file and extract it directly in this folder.
  1. Create a MySQL database:
  • In cPanel, locate the “MySQL Databases” option under the “Databases” section.
  • Create a new database and a user with a strong password. Be sure to assign the user to the database with full privileges.
  1. Configure wp-config.php:
  • Go back to the WordPress files in the File Manager and find wp-config-sample.php. Rename it to wp-config.php.
  • Open the file for editing and enter your database details (database name, username, password, and host, which is usually localhost).
  1. Run the WordPress installer:
  • Visit your subdomain in a browser (e.g., blog.example.com).
  • The WordPress installation wizard will guide you through the final steps, where you’ll set your site title, admin credentials, and more.
  • Once finished, you can log in and start customizing your site.

Step 3: Post-installation tasks

After installing WordPress, there are a few things you should do to secure and optimize your site:

  1. Install SSL: Ensure that your subdomain is using SSL (HTTPS). Many hosts offer free SSL certificates that can be installed through cPanel.
  2. Update WordPress: Make sure you’re running the latest version of WordPress, as well as updating any plugins or themes.
  3. Backup your site: Set up regular backups through a plugin or your hosting provider to protect your data.

Conclusion

Installing WordPress on a subdomain using cPanel is a straightforward process, whether you use a one-click installer like Softaculous or manually set it up. Subdomains are a powerful way to expand your website, and with WordPress, you can easily create new sections such as blogs, portfolios, or stores. If you follow these steps, you’ll have your WordPress site running on a subdomain in no time. Don’t forget to visit my blog for more interesting resources.