Modifying an vhost configuration

NethServer Version: 7 rc3
Module: vhosts nextcloud

Hi - I’ve installed NS 7 rc3, vhosts, samba AD, the nethserver-php-scl and Nextcloud and all is working as intended. Yay.

I’ve moved from Zentyal to NS, and I had my Nextcloud installed at cloud.domain.name. In Nethserver, it is at servername.domain.name/nextcloud. Rather than change all the settings on my client machines, I would rather have nextcloud served from the cloud.domain.name url.

I added a cloud.domain.name/cloud vhost, put a system link from /var/lib/nethserver/vhosts/cloud to the nextcloud installation directory, added the url to the permitted hosts, modified the vhost config for apache to allow following system links, and it worked. But the vhost config gets updated and it stops working. To be expected.

So I am wondering what the best way to get my nextcloud installation served from cloud.domain.name is. Can I make a custom template for that vhost, or for nextcloud configuration? Or would it just be easier to install Nextcloud into the cloud vhost folder?

Cheers,

Don

merci

in fact a custom template should be done with a db property specific to your vhost for activating your followSymlink if needed. @davidep my idea to add more apache directives makes senses :slight_smile:

In this case you will lost all neth customisations, you will are on your own to integrate Nethserver’s users to nexcloud.

The PHP stuff works well. Have to hold my breath while installing ‘needs testing’ stuff on an RC release :wink:

Is there a guide to custom templates anywhere?

Cheers.

Of course :wink:

http://docs.nethserver.org/projects/nethserver-devel/en/v7rc/templates.html

If something is not clear enough, feel free to ask here :wink:

1 Like

Cheers - that helped.

The file paths for the httpd example need to be updated though - I’m guessing it still has the old file paths. I had to put the custom configuration in

/etc/e-smith/templates-custom/httpd/vhost-extra/30directory20options
not the equivalent in

/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/

Don

1 Like

in This case I believe that the ‘Options +FollowSymLinks’ is available for all vhosts, not sure it is good

if you want to set an option following a db property, something like this can be used

vim /etc/e-smith/templates/httpd/vhost-extra/30directory20optionsFollowsymlink

then paste

{
    use esmith::ConfigDB;
    my $vdb = esmith::ConfigDB->open_ro('vhosts') || die("Can't open vhosts db");
    my $FollowSymlink = $vdb->get_prop("$VhostName",'FollowSymlink') || 'disabled';
    $OUT .= "      Options +FollowSymLinks\n" if ($FollowSymlink eq 'enabled');
}

then in your vhost do

db vhosts setprop VHOSTNAME FollowSymlink enabled signal-event vhost-modify VHOSTNAME

I think the easiest way is to build an index.html with the redirection in your vhost.

<meta http-equiv="Refresh" content="seconds; url=URL">

like seen at this forum http://stackoverflow.com/questions/5411538/redirect-from-an-html-page