From a071811dd07b8c28fcdefba3ead35cb12f81d54d Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Wed, 13 Mar 2013 08:16:36 +0100 Subject: [PATCH] respect 'access froxlor directly via hostname' and 'custom docroot in ip/port' setting in nginx, refs #920 Signed-off-by: Michael Kaufmann (d00p) --- scripts/jobs/cron_tasks.inc.http.30.nginx.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/scripts/jobs/cron_tasks.inc.http.30.nginx.php b/scripts/jobs/cron_tasks.inc.http.30.nginx.php index 9e9e0ac2..c8fa5791 100644 --- a/scripts/jobs/cron_tasks.inc.http.30.nginx.php +++ b/scripts/jobs/cron_tasks.inc.http.30.nginx.php @@ -184,9 +184,22 @@ class nginx $this->nginx_data[$vhost_filename].= "\t".'access_log /var/log/nginx/access.log;' . "\n"; $mypath = ''; - if($row_ipsandports['vhostcontainer'] == '1') - { - $mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__)))); + if ($row_ipsandports['vhostcontainer'] == '1') { + + // no custom docroot set? + if ($row_ipsandports['docroot'] == '') { + // check whether the hostname should directly point to + // the froxlor-installation or not + if ($this->settings['system']['froxlordirectlyviahostname']) { + $mypath = makeCorrectDir(dirname(dirname(dirname(__FILE__)))); + } else { + $mypath = makeCorrectDir(dirname(dirname(dirname(dirname(__FILE__))))); + } + } else { + // user-defined docroot, #417 + $mypath = makeCorrectDir($row_ipsandports['docroot']); + } + $this->nginx_data[$vhost_filename].= "\t".'root '.$mypath.';'."\n"; $this->nginx_data[$vhost_filename].= "\t".'location / {'."\n"; $this->nginx_data[$vhost_filename].= "\t\t".'index index.php index.html index.htm;'."\n";