Cloning copies a site to another server, or to the same server under a different domain. Ploi creates the new site, copies all files and takes along the settings it manages. The clone runs in the background and the panel notifies you when it is done. How long it takes depends on the size of the site's files. Site cloning is available on the Pro and Unlimited plans.
Step by step
Open the site and go to Manage.
Click Clone site.
Enter the domain for the copy. The field starts with the current domain, which works when you clone to another server. On the same server you need a different domain.
Pick the server to clone to. The list shows your active servers, including the one the site is on now.
On a WordPress site, tick the database option if you want a copy of the database as well. See WordPress sites below.
If the site has a staging site linked to it, tick the staging option to clone both. See Staging and production below.
Click Start cloning process.
The target server can't already have a site with that domain. Delete that site first or pick another domain.
What Ploi copies
Every file in the site directory, so
.env,vendor,node_modulesand uploaded files come along. On a site with zero downtime deployment, Ploi copies the release that is live at that moment.The PHP version, web directory, project root, project type, system user and the zero downtime deployment setting.
The repository settings and the deploy script. Ploi replaces the old domain with the new one in the deploy script.
Domain aliases, tenants, active redirects and the site's cronjobs.
The system user. If the site runs under a user other than
ploiand the target server doesn't have that user yet, Ploi creates it.
What Ploi does not copy
SSL certificates. Request a new one from the site's SSL tab once the domain points to the target server.
Changes you made to the site's NGINX configuration yourself. The new site gets Ploi's default configuration, so add your own rules again by hand.
Databases, unless it is a WordPress site and you ticked the database option. Clone other databases separately, see How do I clone a database?
Daemons and queue workers. Set those up again on the target server.
DNS records. Your domain keeps pointing where it points now.
After the clone
The copied .env still holds the values of the original site. On a Laravel site, or any application with its own configuration file, check at least the database credentials and APP_URL. If you skip this, the copy keeps reading from and writing to the original database. Then point the domain to the new server and request an SSL certificate.
WordPress sites
On a WordPress site the clone page offers to copy the database too. With that option ticked, Ploi:
creates a new database and database user on the target server, with a random password
copies the contents of the original database into it
writes the new credentials into
wp-config.php, or into.envon a Bedrock siteruns
wp search-replaceto change the old domain into the new one, for plain,http://andhttps://URLs
The search-replace needs WP-CLI on the target server. Without it the database still contains the old domain, and you can run the replacement yourself afterwards, see How do I update all URLs inside a WordPress database using WP-CLI?
To find the database, Ploi uses the database linked to the site. If there is none, it reads DB_NAME from wp-config.php and looks for a database with that name on the server's Databases page. When neither works, Ploi clones the files only and writes the reason to the server logs. Make sure the database shows up under Databases on the server and clone again.
Staging and production
When the site has a staging site linked to it, you can clone both at once and Ploi keeps them linked on the target server. You enter the domain for the site you are cloning and Ploi derives the other one. Clone the production site as example.com and the staging copy becomes staging.example.com. Clone the staging site as staging.example.com and the production copy becomes example.com. Ploi recognises staging., stage., test., dev. and development. as staging prefixes.
If something goes wrong
The files go from the source server straight to the target server over SSH. They don't pass through Ploi, so the source server has to reach the SSH port of the target server. If a firewall blocks that connection, on the target server or at your hosting provider, the clone stops before it creates anything. The server logs of the source server then name the connection that failed. Allow the source server's IP address on the target's SSH port and clone again.
Ploi installs rsync on both servers when it is missing. When the transfer fails anyway, the server logs of the source server contain the rsync output. A transfer that stops without any error usually means the source server ran out of memory, so check its memory usage before you try again.
You can also start a clone through the API, see Clone site in the API documentation.