Can I permanently change the "httpdocs" in Plesk?

I want the DocumentRoot to change from /var/www/vhost/<domain>/httpdocs to /var/www/vhost/<domain>/web/htdocs

At the moment I am making the changes in /conf/vhost.conf then updating /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=domain.com

but that takes a few minutes per domain, and I have to do it for every domain I add that uses my software I've developed.


Beware of editing Plesk files (even apache configs) - many are auto-generated and will be written over by Plesk at some stage.

A simple solution (although one that will slow apache slightly) would be to enable symlinks in httpd.conf and symlink (notice no trailing slashes!):

ln -s /var/www/vhost/<domain>/web/htdocs /var/www/vhost/<domain>/httpdocs 

To automate this (inclusive of creating new dir and moving, if required):

for i in $(find /var/www/vhosts/ -maxdepth 1 -mindepth 1); do 
  mkdir "$i/web" 
  mv "$i/httpdocs" "$i/web/htdocs"
  # create the symlink
  ln -s "$i/web/htdocs" "$i/httpdocs"

The other option is to create vhost.conf files for each domain and load them into the config, there's a walkthrough here.

Not the answer you're looking for? Browse other questions tagged or ask your own question.