custom Apache-config in Plesk

I ran into this problem duzens of times before: I had to make changes in my Apache-config-file to enable a feature in order to make my application work. This is especially the case for ruby-on-rails applications, because they usually require the DocumentRoot to be the “public”-directory inside the rails-app. And since both the Fast-CGI and the Passenger-way of deploying a rails-app require this, I found no other way, that to patch the config file in {domain-name}/conf/http.include.

The downside of this however is, that the next time, you make changes to the domain (or migrate it to another server or user) your changes get overwritten by Plesk, because it generates the http.include-file on the fly and does not look for changes.

But today I found the solution to this:
It turns out, Plesk supports a way for custom changes to the Apache config in so called vhost.conf files. You can put these files in the “conf” directory, both in the main directory or in the subdomain’s dir.

What you write into this file will be included directly into the <VirtualHost> block of the Apache-config.
My first vhost.conf just looked like this:

DocumentRoot /path/to/domain/httpdocs/public

That’s all! And it really works! 😉

To make Plesk include your changes, run:

/usr/local/psa/admin/sbin/websrvmng –reconfigure-vhost –

Have fun with this feature – I know I will! 😉