Change the default storage directory for Plesk

Requirements:
  • You have an account at console.online.net
  • You have a Dedibox dedicated server
  • You have installed the server with Plesk from the management console

By default Plesk stores your sites in the folder /var/www/vhosts and creates subdirectories if required.

However, you can choose another directory for your sites, on another partition for example.
We choose /data/www/ for this tutorial.

This tutorial is based on a single Plesk server on Ubuntu 14.04

Start by connecting yourself to SSH.

You have to use the username and password you have created during the installation of the server.

ssh jvallee@sd-xxxxx.dedibox.fr

Once connected, obtain root permissions:

sudo su

Now copy the data of your existing sites to the new location:

cp -Rp /var/www/vhosts/* /data/www/
You can replace /data/www/ if you have chosen another destination folder.

We will now connect to your MySQL database, where all information about your installation is stored, to make the change:

mysql -uadmin -p`cat /etc/psa/.psa.shadow`

Now you will see a MySQL prompt. We will use the database psa:

mysql> use psa;

Define the new path:

update ServiceNodeEnvironment set value='/data/www/' where name='HTTPD_VHOSTS_D';

Then exit the MySQL prompt:

exit

To finish your modification, you have to reconfigure the service:

/usr/local/psa/admin/sbin/httpdmng --reconfigure-all

You will now be using the new location, for your old and new sites!