|
Jan 16
2010
|
Changing the Default Document Directory in Plesk for a Domain or SubdomainPosted by: John Hobart on Jan 16, 2010 Tagged in: linux
|
|
Sometimes it's tricky to get a package installation to install exactly how you want it. Plesk uses:
/var/www/vhosts/(yourdomain.com)/httpdocs
as the default document directory from which to serve up pages. If it's a subdomain you'll find it in:
/var/www/vhosts/(yourdomain.com)/subdomains/(subdomain name)/httpdocs
This might not work for you for any number of reasons and you might need to set the default document directory to something different. All you need to do is create a vhost.conf file that tells Apache where to look. (Plesk is the control panel, Apache is the web server software bundled with it.)
The procedure is really simple but it's a little different for subdomains than for the main domain. We'll start with the main domain.
Use whatever text editor you like best. (I'm a huge fan of Notepad++ when stuck working on a Windows box but Notepad will work just as well.) Create a file called vhost.conf with a single line:
DocumentRoot /var/www/vhosts/httpdocs/(yourdomain.com)/httpdocs/(path-to-new-document-root)
Replace (yourdomain.com) with your domain and (path-to-new-document-root) with wherever you want Apache to read the files from.
FTP this file to:
/var/www/vhosts/(yourdomain.com)/conf
Now we need to tell Plesk to reload the configuration files. You'll need console access to your server to do this. This is available from your Plesk control panel or if you have permission to SSH into the server you can use a program like Putty to logon to the server. Either way you need to execute the following command:
/usr/local/psa/admin/bin/websrvmng -a
Now if you type http://www.(yourdomain).com into your browser Apache will serve up files from your new directory.
If you're setting a new document root for a subdomain you do pretty much the same thing. Create the vhost.conf file - again with a single line:
DocumentRoot /var/www/vhosts/(yourdomain.com)/subdomains/(subdomain name)/httpdocs/(path-to-new-document-root)
Again replacing (yourdomain.com) with your domain name, (subdomain name) with the subdomain you're changing, and (path-to-new-document-root) with the path of the new document root directory.
FTP this file to:
/var/www/vhosts/(yourdomain.com)/subdomains/(subdomain name)/conf
Per the instructions listed above execute:
/usr/local/psa/admin/bin/websrvmng -a
to get Plesk to reload the configuration files. Finally - and this is important - for subdomains you also have to restart Apache. You do this by executing:
service httpd restart
from the command line or use your Plesk control panel to restart Apache under the System menu.
Now documents located at http://(subdomain name).(yourdomain).com will be served up from the new directory.
Questions? Feel free to drop a note in my community box or leave a comment below.

written by fdsafd, July 08, 2010


Using CentOS 5, Apache 2.2 and Plesk 9:
File: /etc/httpd/conf/httpd.conf
The default DocumentRoot set under Apache 2.2 is /var/www/html
File: /etc/httpd/conf.d/zz010_psa_httpd.conf
Plesk 9 changes the DocumentRoot to /var/www/vhosts/default/htdocs
So, by the time all conf files are processed the DocumentRoot is as set by Plesk. Therefore, in a browser, typing in the default (yourdomain.com) or (server-ip) will result in the index files from /var/www/vhosts/default/htdocs being served.
As multiple domains are added using Plesk, the corresponding directories and sub-directories are created:
ie:
/var/www/vhosts/(yourdomain-1.com)
/var/www/vhosts/(yourdomain-2.com)
/var/www/vhosts/(yourdomain-3.com)
... and so on.
My question is this: If the method described above is used to modify the DocumentRoot for the 'default' domain, does this also affect the other domains under vhosts?
Thanks.