CloudPanel Change Domain Name: Migration Guide (2025)

CloudPanel Change Domain Name: Migration Guide (2025)

Are you concerned about changing your website's domain without a clear plan in place? Domain migration is one of the most technical challenges faced by website administrators. But in CloudPanel, changing the domain name is easy with the right approach.

This tutorial covers four proven techniques for migrating your domain without technical errors. It also covers backing up your site and fixing common migration problems.

Key Takeaways

  • Rebranding updates the domain to reflect the new business identity.

  • CloudPanel creates NGINX, PHP-FPM, and SSL configs for domains.

  • The delete and recreate method migrates content to the new domain.

  • WordPress requires database and URL updates for a domain change.

  • DNS, SSL, and database checks ensure that it maintains post-migration functionality.

CloudPanel Version Compatibility

This guide is compatible with CloudPanel v2.5.1, released in March 2025. It is also compatible with all 2.x versions. CloudPanel has introduced recent enhancements, including

  • PHP 8.4 support
  • MariaDB 11.4 integration
  • Improved security features

If you're using an older version, we recommend updating to the latest release. It will offer the latest security and performance improvements.

Why Change Domain Names?

Reason Explanation Example Migration Priority
Rebranding Rebranding changes your
-company name

-visual identity

-domain name
to reflect new business directions.
Mailchimp switched from "chimpmail.com" to "mailchimp.com". It helped them build a stronger brand identity. Consistency across all platforms
SEO Optimization Selecting domain names with relevant keywords can enhance search rankings. A photo business changing from "johnsmithphotos.com" to "chicagoweddingphotography.com". It will help them target specific search queries. Proper 301 redirects
TLD Change Shifting from less-recognized extensions to established ones like .com can enhance credibility. A nonprofit changing from "savetheforests.org" to "savetheforests.foundation". It will signal their charitable mission. DNS and email configuration
Geographic Expansion Replacing country-specific domains with international extensions supports global growth. An Australian store is changing its domain name. Earlier, it was "sydneyboutique.com.au" Now it will be "fashionfinder.com" to support global shipping. Multi-region considerations
Legal Requirements Domain changes may be necessary due to trademark conflicts or legal disputes. A storage company is changing from "DropBox.io" to "CloudVault.io". It happened after receiving a cease-and-desist letter. Documentation of changes

CloudPanel Domain Structure: Files and Configuration Explained

CloudPanel Domain Structure: Files and Configuration Explained

How CloudPanel Configures Domains

When you create a domain in CloudPanel, the system generates:

  • Document Root Directory: /home/username/htdocs/domainname/

    • Contains your website files

    • Permissions set to username:username

  • NGINX Vhost Configuration: /etc/nginx/sites-enabled/domainname.conf

    • Controls how NGINX handles requests to your domain

    • Contains server_name, SSL paths, and PHP processing directives

  • PHP-FPM Pool Configuration: /etc/php/[version]/fpm/pool.d/domainname.conf

    • Manages PHP process resources for your domain

    • Specifies user, group, and PHP settings

  • SSL Certificates: /etc/letsencrypt/live/domainname/

    • Contains certificates for HTTPS

    • Managed by Let's Encrypt or imported

  • Log Directories:

    • NGINX logs: /home/username/logs/domainname/nginx/

    • PHP logs: /home/username/logs/domainname/php/

These elements integrate with the domain name throughout the system. CloudPanel does not have a "rename" function. It is because changing a domain requires changes to many components.

Key Configuration Files

The main files related to a domain in CloudPanel include:

  • NGINX vhost: /etc/nginx/sites-enabled/domainname.conf

  • PHP-FPM pool: /etc/php/[version]/fpm/pool.d/domainname.conf

  • SSL certificates: /etc/letsencrypt/live/domainname/

  • Website files: /home/username/htdocs/domainname/

4 Methods to Change Domain Names in CloudPanel

Method 1: The Clean Approach - Delete and Recreate

The delete and recreate method is CloudPanel's supported approach. It creates a new site with the desired domain name and migrates your content to it.

When to Use This Method

This approach works best when:

  • You want a clean setup without potential configuration issues.

  • You have time for a complete backup and restore.

  • The site isn't critical during the migration window (15-60 minutes).

  • You prefer following CloudPanel's intended workflow.

Step-by-Step Process

1. Backup Your Existing Site
  1. Create a Full Backup:

    • Log in to CloudPanel.

    • Navigate to your existing domain.

    • Go to the "Backup" section.

    • Click "Create Backup" and wait for the process to complete.

    • Download the backup file to your machine.

    OR

    Use the CloudPanel UI Backup feature

    clpctl backup:create --domainName=olddomain.com

    Export Your Database:

    # Via command line (alternative to UI)

    clpctl db:dump --domainName=olddomain.com --databaseName=your_database

  2. Export Your Database (if applicable):

    • Go to the "Databases" section.

    • Select your database.

    • Click "Export" and save the SQL file.

  3. Document Your Configuration:

    • Take screenshots or notes of your domain settings.

    • Document custom NGINX configurations from the Vhost Editor.

    • Note your PHP version and settings.

    • List cron jobs or extra configurations.

2. Create Your New Domain
  1. Add the New Domain:

    • In CloudPanel, click "Add Domain."

    • Write your new domain name (e.g., newdomain.com).

    • Select the right vhost template (PHP).

    • Click "Save."

  2. Configure Basic Settings:

    • Set the PHP version to match the version used on your old site.

    • Adjust PHP settings to match the prior configuration.

    • Configure needed redirects (www to non-www or vice versa).

  3. Set Up SSL Certificate:

    • Navigate to the "SSL/TLS" section of your new domain.

    • Select "Let's Encrypt" and issue a certificate.

    • Ensure HTTPS works.

3. Restore Your Content
  1. Upload Your Files:

    • Use the File Manager or SFTP to upload your website files.

    • Ensure proper file permissions (644 for files, 755 for directories).

    OR

    Using rsync (safer than regular copy)

    rsync -avz --progress /home/username/htdocs/olddomain/ /home/username/htdocs/newdomain/

  2. Restore Your Database (if applicable):

    • Go to the "Databases" section.

    • Create a new database and user with the same privileges.

    • Import your SQL backup using the CloudPanel UI or command:

      clpctl db:import --domainName=newdomain.com --databaseName=new_database --file=/path/to/backup.sql

  3. Update Configuration Files:

    • For WordPress: Update wp-config.php with new database details.

    • For other CMS frameworks: Update the respective configuration files.

    • Check file paths in configurations that might reference the old domain.

4. Update Internal References
  1. Database Search and Replace (for WordPress):

    Using CloudPanel command line:

    cd /home/username/htdocs/newdomain

    wp search-replace 'olddomain.com' 'newdomain.com' --all-tables --skip-columns=guid

    # Don't forget variants

    wp search-replace 'http://olddomain.com' 'https://newdomain.com' --all-tables --skip-columns=guid

    wp search-replace 'https://olddomain.com' 'https://newdomain.com' --all-tables --skip-columns=guid

  2. Check Hard-Coded URLs:

    # Find files with old domain references

    grep -r "olddomain.com" /home/username/htdocs/newdomain/

5. Test and Confirm
  1. Comprehensive Testing:

    • Verify that all webpages load.

    • Test forms and interactive elements.

    • Check image and resource loading.

    • Confirm email functions.

  2. Set Up Redirects (optional):

    # Add to old domain's vhost configuration

    server {

    `listen 80;`
    
    `listen [::]:80;`
    
    `server_name olddomain.com www.olddomain.com;`
    
    `return 301 https://newdomain.com$request_uri;`
    

    }

Method 2: Domain Aliasing Workaround

Method 2: Domain Aliasing Workaround

This method adds a new domain as an alias of your existing domain. It serves the same content on both domains.

When to Use Domain Aliasing

This approach works when:

  • You need both domains to function during a transition period.

  • You want minimal downtime during the migration.

  • You plan to phase out the old domain.

  • SEO preservation is a priority.

Setting Up a Domain Alias

  1. Access the Vhost Editor:

    • Log in to CloudPanel.

    • Navigate to your existing domain.

    • Click on "Vhost" in the left menu.

  2. Change the server_name Directive:

    • Locate the server_name directive in the configuration file.

    • Add your new domain to the list:

      server_name olddomain.com www.olddomain.com newdomain.com www.newdomain.com;

    • Click "Save."

  3. Add SSL Certificate for the New Domain:

    • Go to "SSL/TLS". Select "Let's Encrypt."

    • Add both your old and new domains.

    • Issue the certificate.

  4. Verify Configuration:

    • Restart NGINX with sudo service nginx restart.

    • Test accessing your site with both domain names.

Setting Up Proper Redirection (Optional)

If you want to move to the new domain:

  • Add Redirection Rules: In the Vhost Editor, add the following at the top of the configuration:

    server {

    `listen 80;`

    listen [::]:80;`
    server_name olddomain.com www.olddomain.com;

    return 301 https://newdomain.com$request_uri; }

  • Update SSL Configuration: Change the HTTPS server block to add similar redirections:

    if ($host = 'olddomain.com' or $host = 'www.olddomain.com')

    {
    `return 301 https://newdomain.com$request_uri;`
    }

  • Save and Test:

    • Verify redirects work.

    • Check for HTTPS warnings or errors.

Method 3: Advanced Vhost Modification Technique

This method modifies the vhost configuration and provides a more comprehensive solution.

Prerequisites and Cautions

  • Basic knowledge of NGINX configuration.

  • SSH access to your server.

  • Backup all configuration files before you start.

  • Comfort with command-line operations.

Implementation Steps

  1. Generate SSL Certificate for the New Domain:

    • In CloudPanel, go to "SSL/TLS."

    • Select "Let's Encrypt."

    • Write your new domain name.

    • Issue the certificate.

    Or via command line:

    sudo certbot certonly --webroot -w /home/username/htdocs/olddomain -d newdomain.com -d www.newdomain.com

  2. Change Vhost Configuration:

    Instead of modifying the existing file, create a new one:

    sudo cp /etc/nginx/sites-enabled/olddomain.com.conf /etc/nginx/sites-enabled/newdomain.com.conf

    Edit the new configuration file:

    sudo nano /etc/nginx/sites-enabled/newdomain.com.conf

    Update all instances of the old domain:

    • Change the server_name directive to use the new domain
    • Update ssl_certificate and ssl_certificate_key paths
    • Change any domain-specific paths or references
  3. Update PHP-FPM Pool Configuration:

    • SSH into your server.

    • Revise the PHP-FPM pool configuration:

      sudo nano /etc/php/7.4/fpm/pool.d/olddomain.conf

      (Replace 7.4 with your PHP version)

    • The file name remains the same as the old domain.

    • Update internal references to the new domain.

    • Save and exit.

  4. Restart Services:

    • Restart PHP-FPM

      sudo systemctl restart php7.4-fpm (Replace 7.4 with your PHP version)

    • Restart NGINX

      sudo systemctl restart nginx

  5. Test Configuration:

    • Access your site with the new domain.

    • Verify HTTPS works.

    • Check for 404 errors or broken links.

Method 4: Shared Document Root Approach

This method creates a new site with the new domain name. It configures it to use the same document root as the old site.

Step-by-Step Implementation

  1. Create a New Site with the New Domain:

    • In CloudPanel, click "Add Domain."

    • Write your new domain name.

    • Select the right vhost template (PHP).

    • Complete the setup.

  2. Generate SSL Certificate:

    • Go to the SSL/TLS section of the new domain.

    • Request a Let's Encrypt SSL certificate for the new domain.

    • Verify it works fine.

  3. Change the Vhost Configuration:

    • Go to the Vhost Editor for the new domain.

    • Replace the original vhost configuration with one from the old domain.

    • Update server_name to use the new domain.

    • Find the root directive and change it:

      root /home/originaluser/htdocs/olddomain;

    • Save the changes.

  4. Update PHP-FPM Pool:

    • SSH into your server.

    • Navigate to the PHP-FPM pool directory:

      cd /etc/php/7.4/fpm/pool.d

      (Replace 7.4 with your PHP version)

    • Revise the new domain's pool file:

      sudo nano newdomain.conf

    • Change the user and group to match the original site:

      user = originaluser

      group = originaluser

    • Save and exit

  5. Restart Services:

    • Restart PHP-FPM

      sudo systemctl restart php7.4-fpm

    • Restart NGINX

      sudo systemctl restart nginx

  6. Verify Configuration:

    • Access the site using the new domain

    • Check for function and resource loading

    • Verify that database connections work

Methods Comparison To Change Domain Name In CloudPanel

Feature Method 1: Delete & Recreate Method 2: Domain Aliasing Method 3: Advanced Vhost Method 4: Shared Root
Difficulty Medium Easy Hard Medium
Downtime 15-60 min None 5-15 min 5-15 min
Data Safety High (with backup) High Medium High
Best For Clean setups, non-production Gradual transitions Experienced admins Quick transitions
Risk Level Medium Low High Medium
CloudPanel UI Usage High Medium Low Medium
Requires SSH Optional Optional Required Required
File Duplication Yes No Configurable No
Reversible Difficult Easy Moderate Easy
Scales to Many Domains Time-consuming Efficient Scriptable Efficient

Method Selection Guide: Which Method To Choose

Question Yes No
Is this a production site with critical uptime requirements? Consider Method 2 or 4 Method 1 may be simpler
Do you need to maintain access via both domains on a temprory basis? Method 2 is ideal Method 1, 3, or 4
Are you comfortable editing configuration files via SSH? Method 3 or 4 viable Stick with Method 1 or 2
Is this a WordPress site with database content? Extra database steps required Simpler migration process
Do you have a tight migration timeline? Method 4 is fastest Method 1 is most thorough

Domain Change for WordPress, Static Sites, Node.js & Python Applications

Domain Change for WordPress, Static Sites, Node.js & Python Applications

WordPress Sites

  1. Database Updates:

    • Use a tool like "Better Search Replace" or WP-CLI

    • Search for all instances of the old domain

    • Replace with new domain

    • Command example with WP-CLI:

      wp search-replace 'olddomain.com' 'newdomain.com' --all-tables --skip-columns=guid

  2. wp-config.php Updates:

    • If you've created a new database, update the database details.

    • Check for domain-specific constants.

      // Find these lines and update them

      define('DB_NAME', 'new_database_name');

      define('DB_USER', 'new_database_user');

      define('DB_PASSWORD', 'new_password');

      define('DB_HOST', 'localhost');

      // Check for domain-specific constants like

      define('WP_HOME', 'https://newdomain.com');

      define('WP_SITEURL', 'https://newdomain.com');

  3. Site URL Settings:

    • Update home and site URL in WordPress Settings.

    • Or update the wp_options table in the database.

    • Or update via WP-CLI:

      wp option update home 'https://newdomain.com'

      wp option update siteurl 'https://newdomain.com'

Static Websites

  1. Check for Absolute URLs:

    • Review HTML files for links using the full old domain path.

    • Update absolute URLs to relative paths when possible.

    • Use the search and replace tools for bulk updates.

  2. Resource References:

    • Check CSS, JavaScript, and image references.

    • Verify font imports and third-party resources.

Node.js Applications

  1. Environment Variables:

    • Update .env files containing the domain name.

    • Check configuration files for hard-coded domain references.

  2. API Endpoints:

    • Update API endpoint references in front-end code

    • Verify CORS settings if needed

Python Applications

  1. Configuration Files:

    • Update settings.py or similar configuration files

    • Check for ALLOWED_HOSTS settings in Django applications

  2. Database Connection Strings:

    • Verify database URLs if they contain domain references

    • Update domain-specific authentication

Post-Migration Checklist: DNS, SSL, Database & Email Configuration

DNS Configuration

  1. Update DNS Records:

    • Add or update A records for the new domain

    • Add AAAA records if you support IPv6

    • Update MX records if you host email on the domain

    • Consider TTL settings during the transition

  2. Verify DNS Propagation:

    • Use tools like dnschecker.org to verify DNS changes

    • Allow time for propagation (a few hours to 24 hours)

SSL Certificate Validation

  1. Check Certificate Status:

    • Verify the certificate works for the new domain

    • Ensure no mixed content warnings exist

    • Test using SSL checkers like SSL Labs

  2. Certificate Renewal:

    • Confirm Let's Encrypt auto-renewal works

    • Run a manual renewal test if needed:

      sudo certbot renew --dry-run

Database Connection Testing

  1. Verify Database Connections:

    • Test all database functions

    • Check for connection errors in logs

    • Verify database user permissions

  2. Performance Check:

    • Track load times after the domain change

    • Check for unusual database query patterns

Email Configuration

  1. Update Email Settings:

    • Update SPF, DKIM, and DMARC records for the new domain

    • Test email sending and receiving

    • Update email addresses in application settings

  2. Notify Users:

    • Inform users of the domain change if needed.

    • Update email templates with the new domain.

Fixing Common CloudPanel Domain Migration Problems & Errors

Fixing Common CloudPanel Domain Migration Problems & Errors

Permission Problems

  1. Symptoms: 403 Forbidden errors, files not writable

  2. Solution:

    • Check file and directory permissions

    • Verify PHP-FPM pool user matches file ownership

  • Command to fix permissions:

    sudo chown -R username:username /path/to/document/root

    sudo find /path/to/document/root -type f -exec chmod 644 {} \;

    sudo find /path/to/document/root -type d -exec chmod 755 {} \;

SSL Certificate Errors

  1. Symptoms: Browser warnings, certificate not trusted.

  2. Solution:

    • Verify certificate paths in the NGINX configuration.

    • Ensure the certificate covers all needed domains.

    • Check for certificate expiry.

    • Reissue the certificate if required.

PHP-FPM Configuration Issues

  1. Symptoms: 502 Bad Gateway, PHP not processing

  2. Solution:

    • Check PHP-FPM pool configuration.

    • Restart the PHP-FPM service.

    • Verify socket or TCP connection settings.

    • Check error logs at /var/log/php/[domain]-error.log.

Database Connectivity Problems

  1. Symptoms: Database connection errors, white screen of death.

  2. Solution:

    • Verify database credentials in configuration files.

    • Check the database host, user, and password.

    • Ensure the database user has proper permissions.

    • Verify that the database server is running.

Broken Links and Resources

  1. Symptoms: Missing images, 404 errors for resources

  2. Solution:

    • Check for hard-coded paths in your code.

    • Update internal links to the new domain.

    • Verify paths in CSS and JavaScript files.

    • Use tools like Screaming Frog to find broken links.

FAQs

1. Can I rename my domain in CloudPanel?

No, CloudPanel does not have a built-in "rename domain" function. To change your domain name, you must use one of the methods in this tutorial.

2. Will changing my domain affect my search engine optimization (SEO)?

With proper 301 redirects, the impact will be small. Expect some rank changes as search engines index your site under the new domain.

3. How long will the domain change process take?

The technical part takes 15-60 minutes, depending on your chosen method. DNS propagation can take up to 24-48 hours for full user access.

4. Will my email address change when I switch domains?

Yes, email services tied to your domain will need changes. Update MX, SPF, DKIM, and DMARC records for the new domain. Update email client settings.

5. What's the best way to tell users about a domain change?

Send email notices if you have the user's email addresses. Add a banner to your site on the old domain. Post on social media two weeks before the change.

Summary

In CloudPanel, changing a domain name requires a methodical approach. This tutorial presented four methods:

  • Delete and Recreate: The cleanest approach, but requires full migration.

  • Domain Aliasing: Simple, but serves both domains at once.

  • Vhost Modification: More technical, but provides a complete solution.

  • Shared Document Root: A good mix of simplicity and effectiveness.

Ready to change your domain name? Select CloudPanel and the method that best suits your technical skills.

Anjali Dalal
Anjali Dalal
Technical Writer

Anjali has 6 years of experience as a technical writer. She writes accessible blogs on CloudPanel, covering servers, databases, load balancers, and DNS settings. She adeptly simplifies complex technical topics into clear, simple content for readers.


Deploy CloudPanel For Free! Get Started For Free!