Guide to Publish a Website to cPanel
Building a website is only the first step. To make it accessible on the internet, the website must be uploaded to a web-hosting server and configured correctly.
In this intermediate course, you will learn how to publish a
website using cPanel, one of the most widely used web-hosting
control panels. You will work with domains, File Manager, FTP
accounts, the public_html directory, databases, file
permissions, SSL certificates and common server settings.
You will also learn how to diagnose and resolve common deployment problems such as broken links, missing files, database connection errors and incorrect folder structures.
Learning Outcomes
What you will be able to do after completing this course.
By the end of this course, you should be able to publish, configure, test, secure and troubleshoot a website hosted through cPanel.
- Explain the purpose of web hosting, domains and cPanel.
- Log in to cPanel securely using the hosting provider's control-panel address.
- Identify important cPanel sections used for deployment.
-
Understand the purpose of the
public_htmldirectory. - Prepare website files and folders before uploading them.
- Compress website files into a ZIP archive.
- Upload and extract website files using File Manager.
- Upload and manage files using an FTP client.
-
Use a recognised homepage filename such as
index.htmlorindex.php. - Configure the correct primary, subdomain or addon-domain folder.
- Create a MySQL database and database user.
- Assign the required database privileges.
- Import an existing database through phpMyAdmin.
- Update website configuration files with database credentials.
- Configure secure file and folder permissions.
- Enable SSL and redirect HTTP traffic to HTTPS.
- Verify that assets and internal links load correctly.
- Correct case-sensitive filename and path errors.
- Use cPanel error logs to investigate website problems.
- Resolve 403, 404 and 500 server errors.
- Back up website files and databases before major changes.
- Replace an existing website without affecting unrelated files.
- Test the published website on desktop and mobile browsers.
- Apply basic cPanel and hosting-account security practices.
Course Roadmap
Follow the deployment process in sequence or select a lesson.
The lessons follow a practical publishing workflow, beginning with hosting concepts and ending with testing, security and maintenance.
Understanding Hosting, Domains and cPanel
Learn how the main parts of website publishing work together.
Domain Name
The human-readable address visitors enter in a browser, such as
example.com.
Web Hosting
The server space that stores website files, databases, email services and related configuration.
cPanel
A browser-based control panel used to manage files, domains, databases, security, email and server features.
How a Visitor Reaches the Website
- Enter Domain
- DNS Lookup
- Hosting Server
- Website Files
- Browser Display
Practice Activity
- Identify the domain registrar for a sample website.
- Identify the hosting provider.
- Record the cPanel login address supplied by the host.
- Find the hosting server's IP address in the account details.
Logging In Securely and Navigating cPanel
Access the hosting account and locate deployment tools.
Secure Login Checklist
- Use the official login address provided by the hosting company.
- Confirm that the login page uses HTTPS.
- Use a unique and strong password.
- Enable two-factor authentication when available.
- Do not save credentials on a shared or public computer.
- Sign out when administrative work is complete.
Important cPanel Sections
| Section | Purpose |
|---|---|
| File Manager | Upload, edit, move, extract and delete files |
| FTP Accounts | Create credentials for FTP or FTPS access |
| Domains | Manage primary, addon and subdomain document roots |
| MySQL Databases | Create databases, users and privileges |
| phpMyAdmin | Import, export and manage database tables |
| SSL/TLS Status | Check certificate coverage and HTTPS availability |
| Errors or Metrics | Inspect recent server-side errors and access information |
Dashboard Exercise
- Log in to a test hosting account.
- Locate File Manager, Domains and MySQL Databases.
- Locate phpMyAdmin and SSL/TLS Status.
- Find the account's disk-usage information.
- Sign out securely.
Understanding public_html and Domain Folder Structures
Publish files to the correct document root.
Primary Domain
The main website commonly uses
public_html as its document root.
Other Domains
An addon domain or subdomain may use a separate folder such as
public_html/shop or another path configured by the
hosting provider.
Example Folder Structure
/home/account/
├── public_html/
│ ├── index.html
│ ├── css/
│ ├── js/
│ ├── images/
│ └── shop/
│ └── index.php
├── logs/
├── mail/
└── backups/
How to Confirm the Document Root
- Open the cPanel Domains section.
- Locate the required domain or subdomain.
- Read the listed document-root path.
- Open the same path in File Manager.
- Confirm that the domain points to the intended folder.
Practice Activity
- Identify the primary domain's document root.
- Identify one subdomain or addon-domain document root.
- Create a text file named
folder-test.txt. - Upload it to the intended folder.
- Confirm whether it is reachable through the expected URL.
Preparing and Compressing Website Files
Organise the project before uploading it to the server.
Pre-Upload Checklist
- Confirm that the homepage is named correctly.
- Remove temporary files, test exports and local backups.
- Remove development-only configuration where appropriate.
- Confirm that asset paths are suitable for the final domain.
- Check whether environment-specific settings must be changed.
- Scan the project for embedded credentials.
- Create a separate backup before modifying the deployment copy.
Correct ZIP Structure
The ZIP archive should normally contain the website files directly:
website-upload.zip
├── index.html
├── css/
├── js/
├── images/
└── assets/
Avoid accidentally adding an unnecessary extra folder:
website-upload.zip
└── my-project/
├── index.html
├── css/
└── images/
Preparation Exercise
- Create a deployment copy of a sample website.
- Remove development-only files.
- Confirm that
index.htmlorindex.phpis present. - Compress the contents into a ZIP archive.
- Open the ZIP and verify its internal structure.
Uploading and Extracting Files with File Manager
Publish a website directly from the cPanel browser interface.
- Open File Manager from cPanel.
- Navigate to the required document root.
- Upload the website ZIP archive.
- Wait until the upload reaches 100%.
- Select the archive and choose Extract.
- Confirm the extraction destination.
- Review the resulting folders and files.
- Move files if they were extracted into an unwanted extra folder.
- Delete the uploaded ZIP after verifying the deployment.
Verify the Result
- The homepage is directly inside the document root.
- CSS, JavaScript and image folders are present.
- File names match the local project.
- No deployment archive remains publicly accessible.
- No unrelated hosting files were overwritten.
Upload Exercise
- Upload a test website ZIP to a test document root.
- Extract the archive.
- Move files into the correct level if required.
- Delete the ZIP archive.
- Open the website in a browser.
Uploading and Managing Files with FTP
Use an FTP client for repeated or large file transfers.
Typical FTP Connection Details
| Field | Example or Purpose |
|---|---|
| Host | The server hostname or hosting account domain |
| Username | The FTP account username created in cPanel |
| Password | A strong, unique password |
| Port | Depends on the supported transfer protocol |
| Remote Directory | The website's document root |
Recommended FTP Workflow
- Create a restricted FTP account for the website folder.
- Use an encrypted transfer option when supported.
- Connect using a trusted FTP client.
- Confirm the remote document-root folder.
- Upload the required files and folders.
- Review failed or skipped transfers.
- Compare local and remote file counts where practical.
FTP Exercise
- Create a test FTP account restricted to a test folder.
- Connect with an FTP client.
- Upload a small website.
- Rename one test file remotely.
- Disconnect and remove the test account when finished.
Homepage Files, Asset Paths and Case Sensitivity
Prevent missing pages, images, stylesheets and scripts.
Recognised Homepage Files
A server normally looks for a default file such as:
index.html
index.htm
index.php
A file named home.html may not load automatically unless
the server is configured to use it.
Relative and Root-Relative Paths
<!-- Relative path -->
<img src="/images/logo.png" alt="Company logo">
<!-- Root-relative path -->
<link rel="stylesheet" href="/css/site.css">
Case-Sensitive Examples
Actual file: images/Logo.png
Incorrect:
<img src="/images/logo.png" alt="Logo">
Correct:
<img src="/images/Logo.png" alt="Logo">
Path Exercise
- Rename an image so its letter case differs from the HTML path.
- Upload the files to a test server.
- Observe the missing image.
- Correct the path or filename.
- Test all internal links and asset requests again.
Creating MySQL Databases, Users and Privileges
Prepare a database for a dynamic website or application.
- Open MySQL Databases in cPanel.
- Create a new database using a clear name.
- Create a new database user with a strong password.
- Add the user to the database.
- Assign the required privileges.
- Record the full database and username values.
- Store credentials securely outside the public website.
Typical Credential Values
Database host: localhost
Database name: accountname_projectdb
Database user: accountname_projectuser
Database password: use-a-strong-secret-password
Database Exercise
- Create a test database.
- Create a separate test user.
- Add the user to the database.
- Assign the required privileges.
- Record the full database and username values securely.
Importing a Database and Updating Configuration
Connect the uploaded website to its production database.
Database Import Workflow
- Open phpMyAdmin from cPanel.
- Select the correct empty database.
- Open the Import section.
- Select the SQL export file.
- Start the import and wait for completion.
- Confirm that tables were created.
- Review any warnings or errors.
Example PHP Configuration
<?php
$dbHost = 'localhost';
$dbName = 'accountname_projectdb';
$dbUser = 'accountname_projectuser';
$dbPass = 'replace-with-secure-password';
?>
Common Connection Problems
- Incorrect database prefix
- Incorrect username or password
- User not assigned to the database
- Missing database privileges
- Wrong host value
- Configuration file not uploaded
- Environment variables not available on the server
Import Exercise
- Export a small test database locally.
- Import the SQL file into the cPanel test database.
- Confirm that the expected tables appear.
- Update a test application's configuration.
- Load the application and verify database connectivity.
Configuring File Permissions and Basic Security
Allow the website to function without exposing sensitive files.
| Item | General Principle |
|---|---|
| Public files | Readable by the web server |
| Directories | Accessible so the web server can enter and read them |
| Configuration files | Restricted as much as the application and host allow |
| Upload folders | Writable only where the application requires it |
| Executable scripts | Limited to trusted files and necessary locations |
Basic Hosting Security Checklist
- Use unique passwords for cPanel, FTP and databases.
- Enable two-factor authentication where available.
- Remove unused FTP accounts.
- Delete obsolete installers and test scripts.
- Keep CMS software, extensions and themes updated.
- Do not store backups inside publicly accessible folders.
- Restrict configuration and environment files.
- Review unfamiliar files after a suspected compromise.
Security Review
- Identify publicly writable folders in a test application.
- Confirm that only required folders are writable.
- Remove an unused test FTP account.
- Locate and remove a public ZIP backup.
- Enable two-factor authentication if supported.
Enabling SSL and Redirecting HTTP to HTTPS
Protect traffic and serve the website securely.
SSL Deployment Workflow
- Confirm that the domain points to the hosting server.
- Open SSL/TLS Status or the provider's certificate tool.
- Check whether the domain and required subdomains are covered.
- Run or request certificate installation when necessary.
- Open the HTTPS version of the site.
- Enable an HTTPS redirect.
- Check for mixed-content warnings.
Common .htaccess Redirect
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>
HTTPS Exercise
- Check certificate coverage for a test domain.
- Open the website using HTTPS.
- Enable the redirect using the host's tool or configuration.
- Confirm that HTTP automatically redirects to HTTPS.
- Check the browser console for mixed-content errors.
Diagnosing Broken Assets, Links and Server Errors
Use browser and cPanel tools to find deployment problems.
Browser Troubleshooting Tools
- Use the Network panel to find failed requests.
- Use the Console to identify JavaScript and mixed-content errors.
- Inspect the final requested URL for each missing asset.
- Check the HTTP response status.
- Disable browser cache temporarily while testing updates.
cPanel Troubleshooting Tools
- Error logs
- Raw access logs
- File Manager
- Disk-usage information
- PHP version and configuration tools
- Database and phpMyAdmin tools
Asset Verification Process
- Copy the failed asset URL from the browser.
- Open the URL directly.
- Compare the URL with the server folder structure.
- Check spelling and letter case.
- Confirm file permissions.
- Review rewrite rules if the path should be routed dynamically.
Troubleshooting Exercise
- Intentionally break one image path.
- Use the browser Network panel to find the failed request.
- Compare the requested URL with File Manager.
- Correct the path.
- Review the cPanel error log for recent entries.
Resolving Common cPanel Deployment Errors
Understand what common HTTP error codes usually indicate.
| Error | Common Causes | First Checks |
|---|---|---|
| 403 Forbidden | Permissions, missing index file, access rules or blocked directory | Permissions, homepage filename and .htaccess rules |
| 404 Not Found | Wrong URL, missing file, incorrect document root or rewrite issue | File path, letter case and domain folder |
| 500 Internal Server Error | Invalid server rule, PHP error, incompatible version or fatal application error | Error log, .htaccess and PHP configuration |
Safe Troubleshooting Sequence
- Record the exact URL and error code.
- Check whether the issue affects one page or the entire site.
- Review the most recent server error-log entry.
- Check recent file or configuration changes.
- Temporarily rename a suspected .htaccess file for testing.
- Confirm the PHP version and required extensions.
- Restore the last working version if necessary.
.htaccess file before editing it.
One invalid directive can cause a site-wide 500 error.
Error Exercise
- Create a test page with an incorrect URL and observe the 404.
- Rename the homepage temporarily and observe the result.
- Restore the homepage.
- Review the error log.
- Document the exact fix used.
Backing Up, Replacing and Testing a Website
Update an existing site safely and verify the final deployment.
Backup Before Changes
- Download or archive the existing website files.
- Export the current database.
- Record the active document root.
- Save the current configuration file.
- Confirm that the backup can be opened.
- Store the backup outside the public web folder.
Safe Replacement Workflow
- Identify all files that belong to the target website.
- Do not modify unrelated domain, email or application folders.
- Create a backup folder outside the public document root.
- Move the current website files into the backup folder.
- Upload and extract the new website.
- Restore required configuration or user-uploaded content.
- Test before removing the old backup.
Final Testing Checklist
- Homepage loads over HTTPS.
- Navigation links work.
- Images, fonts, CSS and JavaScript load.
- Forms submit correctly.
- Database-powered pages work.
- No sensitive files are publicly downloadable.
- Desktop layout works.
- Mobile layout works.
- Browser console contains no major errors.
- Server error log contains no new critical entries.
Maintenance Exercise
- Create a ZIP backup of a test website.
- Export its database.
- Replace the website with a revised version.
- Test the revised site on desktop and mobile.
- Restore the backup to prove the rollback process works.
Final Project: Publish and Configure a Website
Apply the complete cPanel deployment workflow.
Project Requirements
- Identify the domain and correct document root.
- Create a backup before deployment.
- Prepare a clean deployment copy.
- Compress the website into a ZIP archive.
- Upload and extract the files using File Manager.
- Confirm the homepage filename.
- Verify the final folder structure.
- Create a database and database user if required.
- Assign the required privileges.
- Import the database with phpMyAdmin.
- Update production database credentials.
- Apply suitable permissions.
- Enable and test HTTPS.
- Verify all images, scripts and stylesheets.
- Review browser and server errors.
- Test desktop and mobile layouts.
- Document the rollback procedure.
Recommended Deployment Workflow
- Back Up
- Prepare
- Upload
- Position
- Configure
- Secure
- Inspect
- Launch
Final Verification Checklist
- The correct domain displays the intended website.
- The homepage loads without a manual filename in the URL.
- HTTPS is active and HTTP redirects correctly.
- All navigation links work.
- All images and media load.
- Stylesheets and scripts return successful responses.
- Database-powered pages load correctly.
- No default hosting page remains visible.
- No deployment ZIP or SQL file is publicly accessible.
- There are no major browser-console errors.
- There are no new critical server errors.
- The site works on desktop and mobile.
- A complete backup and rollback path are available.
Congratulations!
You have completed Guide to Publish a Website to cPanel.
You can now prepare website files, upload them through File Manager or FTP, configure domains and databases, apply permissions, enable HTTPS, investigate server errors and test a complete website deployment.
Continue practising with staging domains and small test projects. A reliable deployment process should always include preparation, backup, verification, security checks and a tested rollback plan.

