Question

Duplicate Website

Posted April 22, 2021 400 views
ApacheDigitalOceanBackupsDeploymentDatabases

Hello there. Am new in Digital Ocean.
I need someone to copie my principal website to a new sub domain with a new database, new SFTP account.

Can you please help me?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @charlenevalmorin,

In our public community, we aim to answer open questions about anything SysAdmin, DigitalOcean, and beyond. We can give you pointers as to how to do it but if you require a service that’s usually payable I’ll recommend reaching other websites that do offer freelance work.

If you want to copy your website to an we subdomain, I can give you some pointers.

  1. SSH to your droplet
ssh root@YourDropletIP
  1. Setting Up Virtual Host for your subdomain

Create the directory for your_domain as follows:

sudo mkdir /var/www/your_domain

Next, assign ownership of the directory with the $USER environment variable:

sudo chown -R $USER:$USER /var/www/your_domain

The permissions of your web roots should be correct if you haven’t modified your umask value, which sets default file permissions. To ensure that your permissions are correct and allow the owner to read, write, and execute the files while granting only read and execute permissions to groups and others, you can input the following command:

sudo chmod -R 755 /var/www/your_domain

Now to the VirtualHost

sudo nano /etc/apache2/sites-available/your_domain.conf

Paste in the following configuration block, which is similar to the default, but updated for our new directory and domain name:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName your_domain
    ServerAlias www.your_domain
    DocumentRoot /var/www/your_domain
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Save and close the file when you are finished.

Let’s enable the file with the a2ensite tool:

sudo a2ensite your_domain.conf
sudo systemctl restart apache2
  1. Copy your website over.

Now, you need to copy over your website like so

cp -rav /path/to/website /path/to/subdomain

This will copy all folders from your main website to the subdomain you added.

To create the Database, please let me know what MySQL/MariaDB version you are using so that I can provide you with the proper steps.