• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Document Root

scottthepotter

Basic Pleskian
When I change the document root served websites, occasionally and whenever I reboot the server Plesk reconfigures them to be /var/www/vhosts/domain-name/httpdocs. How do I keep Plesk from doing this?
 
I am using the Apache webmin module (since there isn't a way to do this in Plesk) but I am not sure where Webmin makes those changes.
 
Since the psa.conf file I am guessing is a Plesk configuration file, then probably not. Is that where I should set the document roots in the psa.conf file?
 
if I remember correctly it is

Code:
cat /etc/psa/psa.conf | grep 'HTTPD_VHOSTS_D'

if you change it here I believe you also have to reconfigure all your existing vhosts as well as restart psa

I could be mistaken though, so try at your own risk - but let me know if works for you.
 
I believe that this will only change the vhost directories for all virtual sites. Not specific ones. Currently Plesk has the directory set for /var/www/vhosts then within that, the document root is set to domain-name/httpdocs, although I am not sure what sets that as it is not in the httpd.conf file. Webmin actually allows you to change document root of each virtual host to anything within that virtual host directory. So I could change the root to /var/www/vhosts/<domain-name>/httpdocs/joomla. I can't figure out where Webmin is getting this information from though. When I change the document root here it stays for a "period of time". Usually until I upgrade Plesk or physically restart the server then everything reverts back to /var/www/vhosts/<domain-name>/httpdocs. Plesk is a nice interface for the end user who wants to manage their domain settings and it is "okay" for administering web services, but there are too many things that you just can't get to with it. And if you make a change outside of Plesk then you have to deal with the consequences of how Plesk reacts.
 
oh, ok I think I finally understand what you mean then, sorry.
I also think I see the problem.

If you go to
/var/www/vhosts/<domain>/conf/vhost.conf

and then search for the doc root

cat httpd.include | grep '/var/www/vhosts/'

You see it show up in a few places.

One of them should look like:
DocumentRoot /var/www/vhosts/<domain>/httpdocs

Now you can change that and it will take effect once you restart apache. But the problem is that a lot of the times when psa restarts, reboots, or the domain has a change that occurs in plesk the httpd.include file gets overwritten each time - so all changes are lost.

You will need to put the changes into a vhost.conf file there instead and then do the reconfigure command

/usr/local/psa/admin/bin/websrvmng -u --vhost-name=<domain>[/QUOTE]

I think you just have to add

DocumentRoot /var/www/vhosts/<domain>/httpdocs/folder

But to make this overly simple, wouldnt it just be easier to move the web site to the root instead?
 
Actually I was thinking " to make it overly simple wouldn't it be great if Plesk allowed me to change my document root on a virtual host basis"? It is strange because I "rent" my server from 1and1 and if you use 1and1's shared hosting you can actually do this from within their control panel, which is home grown not cpanel not plesk. But you are probably right, might be easier in the long run to move the site up one level. Thanks for trying though.
 
Okay, here is an interesting discovery. None of the domains that I am hosting has a vhost.conf file in the <domain-name>/conf folder. The only file in that folder is an httpd.include file which makes reference to the vhost.conf in the comments section and says that it should be in this same folder.
 
no domain has one by default unless you create it in the skeleton directory. You need to create one manually for any domain you wish to have a permanent server setting change
 
Back
Top