Skip to content
  • Solutions
    By Role
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    By Infrastructure
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
  • Product
    • Plesk Features
    • Plesk Editions
    • What’s new
    • Pricing
    • Roadmap
    • Lifecycle Policy
    • Extensions Catalogue
  • Pricing
  • Extensions
    Featured Extensions
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    Bundles and packs:
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack

    See all Extensions

  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
Plesk 360 login
Free Trial

Knowledge Base

How to change virtual hosts location in Plesk for Linux?

 
backupdomainsdowntimelinuxplesk for linux

Question

How to change virtual hosts locations in Plesk for Linux?

How to replicate website vhost and root document path during migration from a non-Plesk server?

Answer

NOTE: These actions may cause websites downtime depending on the number of domains and data to be copied to the new location. It is recommended to apply this during maintenance hours.

Change the default virtual hosts to a custom one
Fix SELinux context

Warning: Changing vhosts directory with the SELinux enabled in Plesk (on RPM-based Linux distributions) will break websites, refer to the 'Fix SELinux context' tab to apply the fix for the servers with SELinux enabled. As an alternative, keep SELinux in the permissive mode for the correct website's working capacity. 

1. Connect to the server via SSH

2. The location change can be done using transvhosts.pl utility, run command with --help argument to learn about it:

# plesk bin transvhosts.pl --help

3. To change virtual hosts location to /home/vhosts/ directory for example run the following command (replace /home/vhosts/ with the actual path to target directory):

# plesk bin transvhosts.pl --dest-dir /home/vhosts/ --correct-scripts

All virtual host content will be automatically moved to the new location.

Note: changing virtual host location will not affect backup restoration functionality. Content from backups will be restored to new custom location.

Warning: running restorecon on the virtual host directory or its parent directory will revert this fix.

1. Connect to the server via SSH

2. Run the following commands to fix the SELinux context for the custom virtual host directory (make sure to replace /home/vhosts/ with the actual path to virtual host directory):

# chcon -R system_u:object_r:httpd_sys_content_t:s0 /home/vhosts/

# find /home/vhosts/ -maxdepth 2 -type d -name logs -exec chcon -R root:object_r:httpd_log_t:s0 {} ;

# find /home/vhosts/ -maxdepth 2 -type d -name bin -exec chcon -R system_u:object_r:bin_t:s0 {} ;

# find /home/vhosts/ -maxdepth 3 -path '*/etc/*' -name resolv.conf -exec chcon system_u:object_r:net_conf_t:s0 {} ;

Note: vote for these steps to be automated in the Plesk UserVoice portal. The top-ranked suggestions are likely to be included in the next versions of Plesk.

Tweet
Share
Share
Email
0 Shares
Read the full article
Related Posts

How to Check Open Ports in Linux (Simple Commands & Tools)

Read More »

Linux Logs Explained

Read More »

Exploring Plesk’s Added Value Solutions So Far in 2023

Read More »
Knowledge Base

How to remove Plesk backup files and their logs

Read More »

WordPress instances marked as broken in: Plesk WP Toolkit has found WordPress files at the following path

Read More »

A website is not responding when a database backup/copy operation is running in Plesk: Error establishing a database connection

Read More »

How to upload a Plesk xml.tar/xml.zip backup file to Plesk Backup Manager

Read More »

Hosting Wiki

  • Server Redundancy
  • Linux Containers
  • Bare Metal Server
  • Backup
  • Oracle VM Server
  • Server Virtualization Software
  • Windows Server
  • Linux
  • Domain
  • Plesk
  • Web Server
  • DNS Server
  • SSH
X-twitter Linkedin Youtube Reddit Github
  • Product
  • Login
  • Pricing
  • Editions
  • For Partners
  • Partner Program
  • Contributor Program
  • Affiliate Program
  • Plesk University
  • Company
  • Blog
  • Careers
  • Events
  • About Plesk
  • Our Brand
  • Resources
  • User and Admin guides
  • Help Center
  • Migrate to Plesk
  • Contact Us
  • Hosting Wiki
  • Forum
  • Legal
  • Legal
  • Privacy Policy
  • Imprint

© 2025 WebPros International GmbH

Part of the WebPros®  Family