Usually, I work with CPanel. But some time ago my friend asked me to move his website to a server with Plesk installed by default. Website required domain sub.domain.com to point to a folder inside main site webroot. I surprizingly found, that with Plesk 9 it is impossible (it was ok with old versions where Plesk allowed to choose subdomain destination folder). I had to find a way to overcome that.
It is easy. But you need to be root for that.
Open /var/www/vhosts/domain.com/subdomains/sub/conf/vhost.conf in editor.
Add to it the following contents (for sub.domain.com):
DocumentRoot /var/www/vhosts/domain.com/httpdocs/sub
<Directory /var/www/vhosts/domain.com/httpdocs/sub>
<IfModule sapi_apache2.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs:/tmp"
</IfModule>
<IfModule mod_php5.c>
php_admin_flag engine on
php_admin_flag safe_mode off
php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs:/tmp"
</IfModule>
Options -Includes -ExecCGI
</Directory>
After that you need to reconfigure Plesk by using command
/usr/local/psa/admin/bin/websrvmng -a
That will do.





August 24th, 2010 4:45 pm
Hi, great post!!
Very helpful.
By any reason, do you know if this works on version 9.5? I can’t find the vhost.conf
Cheers,
Diogo
August 24th, 2010 4:51 pm
It should work. Just create the file.
August 24th, 2010 5:00 pm
Thanks
April 21st, 2011 7:24 pm
This is just what I was looking for – I’ve created and saved the file, but it hasn’t made any difference. I’ve also restarted Apache. Is there anything else I need to do?
April 21st, 2011 7:57 pm
You need to restart Plesk.
April 21st, 2011 10:14 pm
Okay, I’ve done that as well. Must be missing something else?
April 21st, 2011 10:38 pm
Yea. Reconfigure Plesk: /usr/local/psa/admin/bin/websrvmng -a
Thanks, article updated.
April 21st, 2011 10:57 pm
I’ve done all of that and now Apache won’t even show it’s default page! I’ve got a 500 Server internal Error. :/
April 22nd, 2011 12:10 am
That means Apache is incorrectly configured. Check it’s error log, it will tell you what’s wrong.
April 22nd, 2011 1:25 pm
For some reason, I can’t access the log.
Domain user login can’t get to it – Root login only shows Parallels, psa and plesk.key entries?!
April 22nd, 2011 2:51 pm
I’ve had to pay someone else to fix it – Thanks for your help.
April 22nd, 2011 3:06 pm
I may help you free of charge, I think. But I will need root access to the server for this.
August 21st, 2011 9:28 am
[...] I will answer myself. Published a solution in my blog: http://www.fractalizer.ru/frpost_418/plesk-9-adding-a-subdomain-tp-custom-folder-inside-webroot/ [...]