How to use vhost.conf in Plesk

Tue 31 July 2007

Maybe you need to do some specific configurations for a domain or subdomain and you tried to do directly in httpd.include file. You saw that it works for the momment but plesk will delete again your specific configurations from this file. So, in this case the answer is vhost.conf file. This file will be placed inside your domain’s conf directory, usually found at /var/www/vhosts/domain.com/conf. Create a file called vhost.conf in whatever editor you prefer. I use vim.

You can now put in any Apache configuration options like you would into httpd.include. In my case I wanted to do only one thing, to have subversion repository accesible over web, without any kind of access restriction.
Here is my vhost.conf file:

    DAV svn
    SVNPath /home/svn

Now, you need to tell Plesk to update it’s information.
You have to run:

    # /usr/local/psa/admin/sbin/websrvmng -u --vhost-name=domain.com

this will configure plesk only for one single domain, in this case domain.com
If you want to configure it for all sites run:

    # /usr/local/psa/admin/bin/websrvmng -a

After this command if you look to httpd.include file, will see that your httpd.include will have an include line for your vhost.conf, something like this:

    Include /srv/www/vhosts/domain.com/conf/vhost.conf

There is also a vhost.conf file for subdomain in their DocumentRoot directory, if you want to do some specific things for subdomain.

That's all, bye!