Duplicating Shopware 6 in Plesk

This step-by-step guide shows you how to duplicate your Shopware 6 store in Plesk.


Prerequisites

  • Managed Server
  • Shopware 6
  • Plesk Control Panel


In summary, duplicating a Shopware 6 store in Plesk allows you to safely test changes, customize the store, perform development tasks, and improve scalability.



Duplicating Shopware 6


Open the Plesk Control Panel in your web browser. See also: Logging in to the Plesk Control Panel


Create a New Website

First, create the new website in Plesk where the shop will be duplicated.

You can create a new website by clicking the Add Domain button. Enter the desired domain under which the copied Shopware store will later be accessible.



For the copy, you can use, for example, the test domain of the Shopware server. This follows the syntax: sXXXX.creoline.cloud. Replace the prefix with your server ID.


Under Webspace, select the webspace for the domain that you want to copy.


Also specify the system username that will later become the owner of the Shopware copy on the server.


To further secure your website via SSL/TLS, you can set up a free Let’s Encrypt certificate for the Shopware copy. You can find step-by-step instructions in the Help Center article Set Up a Let’s Encrypt Certificate.


Create a Database

In Plesk, navigate to Websites & Domains and select one of the two domains on which your Shopware 6 copy is installed or will be installed.


Click the Databases tab and create a new database for the duplicated store. See also: Create a MySQL Database


Copying a Shopware 6 Store

Under "Hosting & DNS" → "Hosting Settings," remove the document path /public for the duration of the copying process.


Your Shopware 6 store will be temporarily unavailable due to this change. After the copying process is complete, you can re-add the /public path.


Go back to the domain overview page and click the “Copy Website” button. The Plesk interface for copying a website will open.




In Plesk, you can choose whether to copy your Shopware 6 store to a website in Plesk or to another server via an FTP connection.


We’ll use the method to copy the website to Plesk and select the name of the website to which Shopware 6 should be copied. If your website or domain isn’t displayed, you’ll need to create it first in Plesk under “Domains.” You can also use a subdomain, such as dev.mydomain.de or dev.sXXXX.creoline.cloud.



Please note that selecting “Delete all existing files” will irrevocably delete all files in the destination directory.


In this case, we want all files in the destination directory to be deleted, since we have created the domain from scratch and therefore there are no important files in the directory. We can confirm our selection by clicking “OK.” The following message appears in Plesk:


Important Under Hosting & DNS → Hosting Settings, add the document path /public for both domains so that your Shopware 6 store is accessible again.



Copy the Database


When copying the database, tables are temporarily locked, which may briefly and minimally affect your application’s performance.


First, identify the database currently used by the store in the Shopware configuration file located at /document_root/.env.local.


The following line specifies which database is being used:

DATABASE_URL=mysql://[DB_USERNAME]:[DB_PASSWORD]@[DB_SERVER]:[DB_PORT]/[DB_DATABASE_NAME]

In our case, the .env.local directive looks like this:

DATABASE_URL=mysql://shopware_6:password@localhost:3306/shopware_6


In Plesk, navigate to Domain of the current store → Databases and select “Copy” for the database you identified earlier.



Once there, we can either create and name a new database or use the database we created earlier.


We want to create a full copy of the database and confirm this by clicking “OK”.


It is recommended to select the “Create a full copy” option. This helps avoid complications during the copying process.

Afterward, we’ll see the following message in Plesk, indicating that the copy was successful:


Next, update the .env.local file for the store copy to use the database copy.

DATABASE_URL=mysql://[DB_USERNAME]:[DB_PASSWORD]@[DB_SERVER]:[DB_PORT]/[DB_DATABASE_NAME]

In our case, the .env.local directive will then look something like this:

DATABASE_URL=mysql://shopware_6_copy:password@localhost:3306/shopware_6_copy



Clear the Cache

Clear the cache of your cloned Shopware 6 store by connecting to the server via SSH.

Navigate to the root directory of the cloned store.

The command might look like this, for example:

/var/www/vhosts/sXXXXX.creoline.cloud/swcopy.sXXXXX.creoline.cloud/

Once there, execute the following CLI command:

php bin/console cache:clear


Shopware CLI commands should always be executed as a system user. Executing them as the root user can lead to unintended side effects.


The cache should be cleared. If an error occurs, try clearing the cache manually by navigating to the following path:

/var/www/vhosts/sXXXXX.creoline.cloud/swcopy.sXXXXX.creoline.cloud/var/cache

and run the following command there:

rm -rf prod_*



Customize the Sales Channel

To customize the sales channel for your Shopware 6 store, log in to your Shopware 6 administration area using the same login credentials you used for your previous store.

Once there, navigate to your store and scroll down a bit until you see the "Domain" tab, then adjust both entries so that they match the domain of the copied store.

After customizing the sales channel, click the Save button in the upper-right corner to apply the changes.


After adjusting the domains, the front end of the Shopware 6 instance copy will be accessible via the specified domain in the browser of your choice.


You have now completely duplicated your Shopware 6 store.