Virtual hosts Options

virtualhosts
v7

(Dominik) #1

Hello Neth Tribe,
I need to add to virtualhosts.conf this options:

Options +FollowSymLinks

I can add it manually but after i.e. some changes in vhosts via nethgui this option is lost.

How to make it permanent?


(Markus Neuberger) #2

Hi Dominik,

I assume you need it for one vhost and not for all.

mkdir -p /etc/e-smith/templates-custom/httpd/vhost-extra/

Create /etc/e-smith/templates-custom/httpd/vhost-extra/30directory20optionsFollowSymlinks with following content:

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

Set FollowSymlinks to enabled and expand the template:

db vhosts setprop YOURVHOST FollowSymlinks enabled
expand-template /etc/httpd/conf.d/virtualhosts.conf

Stolen from here:

Documentation:

http://docs.nethserver.org/projects/nethserver-devel/en/v7/templates.html#subdirectory-templates


(Dominik) #3

Hello @mrmarkuz!

Thank’s for to solutions - as soon as I get my VPS configured (with NS7) i will try to implement this and let you know how i t goes :slight_smile:


(Davide Principi) #4

Can we achieve the same with an .htaccess file ?


(Dominik) #5

:thinking: I have’nt think about that solutions - but the .htaccess file could be modified by PrestaShop (which i am moving from one of my client from shared hosting to VPS) - but i will try to test this scenario also.

thanks @davidep


(Markus Neuberger) #6

This seems to be the easier solution for @des :

Create .htaccess in /var/lib/nethserver/vhost/YOURVHOST

with following content:

Options +FollowSymLinks


(Dominik) #7

Hi @mrmarkuz solution with .htaccess don’t work - PrestaShop rewrites this so i will had to made changes manually but your earlier solutions with custom template works!

Thank you!


Virtual Host + SSL certificate + PrestaShop