How to move the vhosts directory in Plesk

Plesk-LogoThe default directory for all web files in Plesk on Linux is /var/www/vhosts. Usually this works well, but if you’d like to use another partition instead, you’ll be pleased to hear that you can!

Parallels (or Odin as we call them now) have written a handy script which moves the content and patches the relevant configuration file and copies all content at the same time. The script is called transvhosts and you can download it here:

Download it using wget and make the file executable:

wget http://kb.sp.parallels.com/Attachments/kcs-12467/transvhosts.pl
chmod +x transvhosts.pl

It’s a PERL script, which means it needs prefixed with ‘perl’ to be called. Say you want to move your vhosts directory to /home/vhosts, you’d call it like this:

perl transvhosts.pl --dest-dir /home/vhosts --correct-scripts

Moving files to new directory...
Correct psa configuration file...
Correct passwd file...
Correct server configuration files...
Clean up symlinks...
/etc/httpd/conf/plesk.conf.d/vhosts
Correct php-fpm pools configuration...
Moving files to new directory...
Correct psa configuration file...
Correct passwd file...
Correct server configuration files...
Clean up symlinks...
/etc/httpd/conf/plesk.conf.d/vhosts
Correct database...
Update hosting settings...
done
Update subdomains settings...
done
Update system users settings...
done
The service node 'local' was successfully updated.
Correct user scripts...

This may take a moment or two depending on the amount of content you have in the current directory. The script will patch Plesk’s configuration file and restart the panel. There’s minimal downtime in involved in this process.





Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.