Virtual Hosts Document Root


(Jozef Francois) #1

I’d like to change the default document root for the html website files of my vhost (public accessible).
It is now in /var/lib/nethserver/vhost/“myftpuser”
I prefer it to be /var/lib/nethserver/vhost/“myftpuser”/public_html
How can I change this? I don’t find the configuration file.

(Markus Neuberger) #2

It’s in /etc/httpd/conf.d/virtualhosts.conf but it’s a templated config file so you shouldn’t change it directly.

You may create a custom template but in this case it’s not recommended as you have to override an original template and updates may not be applied. Why do you need that special config? Maybe we find another way to solve this.

The bad solution:

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf.d/virtualhosts.conf/
cp /etc/e-smith/templates/etc/httpd/conf.d/virtualhosts.conf/20virtual_hosts /etc/e-smith/templates-custom/etc/httpd/conf.d/virtualhosts.conf/

Change line 20 in /etc/e-smith/templates-custom/etc/httpd/conf.d/virtualhosts.conf/20virtual_hosts to

$vhostData{DocumentRoot} = '/var/lib/nethserver/vhost/'.$vhost->key.'/public_html';

(Jozef Francois) #3

It’s not really a special config.
It’s standard directory structure in control panels like Direct Admin and cPanel and I’m used to it.
But I see your point. Ther’s no real need for it, so I’ll drop my question.
Thanks anyway, Markus!