revert last nginx-fix (nonsense) and now respect 'vhost-statement=no' setting for froxlor-vhost (no server-block), fixes #1076

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-04-15 13:13:36 +02:00
parent 802d59670c
commit 8f127e4769

View File

@@ -168,27 +168,21 @@ class nginx
$this->nginx_data[$vhost_filename] = ''; $this->nginx_data[$vhost_filename] = '';
} }
if ($row_ipsandports['vhostcontainer'] == '1') {
$this->nginx_data[$vhost_filename].= 'server { ' . "\n"; $this->nginx_data[$vhost_filename].= 'server { ' . "\n";
/** /**
* this HAS to be set for the default host in nginx or else no vhost will work * this HAS to be set for the default host in nginx or else no vhost will work
* edit: as of #1076 this is optional but should be deactivated with CARE as it
* might break a lot
*/ */
if ($row_ipsandports['listen_statement'] == '1') {
$this->nginx_data[$vhost_filename].= "\t". 'listen ' . $ip . ':' . $port . ' default;' . "\n"; $this->nginx_data[$vhost_filename].= "\t". 'listen ' . $ip . ':' . $port . ' default;' . "\n";
}
if($row_ipsandports['vhostcontainer'] == '1')
{
$this->nginx_data[$vhost_filename].= "\t".'# Froxlor default vhost' . "\n"; $this->nginx_data[$vhost_filename].= "\t".'# Froxlor default vhost' . "\n";
$this->nginx_data[$vhost_filename].= "\t".'server_name ' . $this->settings['system']['hostname'] . ';' . "\n"; $this->nginx_data[$vhost_filename].= "\t".'server_name ' . $this->settings['system']['hostname'] . ';' . "\n";
}
$this->nginx_data[$vhost_filename].= "\t".'access_log /var/log/nginx/access.log;' . "\n"; $this->nginx_data[$vhost_filename].= "\t".'access_log /var/log/nginx/access.log;' . "\n";
$mypath = ''; $mypath = '';
if ($row_ipsandports['vhostcontainer'] == '1') {
// no custom docroot set? // no custom docroot set?
if ($row_ipsandports['docroot'] == '') { if ($row_ipsandports['docroot'] == '') {
@@ -209,8 +203,7 @@ class nginx
$this->nginx_data[$vhost_filename].= "\t\t".'index index.php index.html index.htm;'."\n"; $this->nginx_data[$vhost_filename].= "\t\t".'index index.php index.html index.htm;'."\n";
$this->nginx_data[$vhost_filename].= "\t".'}'."\n"; $this->nginx_data[$vhost_filename].= "\t".'}'."\n";
if($row_ipsandports['specialsettings'] != '') if ($row_ipsandports['specialsettings'] != '') {
{
$this->nginx_data[$vhost_filename].= $row_ipsandports['specialsettings'] . "\n"; $this->nginx_data[$vhost_filename].= $row_ipsandports['specialsettings'] . "\n";
} }
} }
@@ -218,37 +211,27 @@ class nginx
/** /**
* SSL config options * SSL config options
*/ */
if($row_ipsandports['ssl'] == '1') if ($row_ipsandports['ssl'] == '1') {
{ if ($row_ipsandports['ssl_cert_file'] == '') {
if($row_ipsandports['ssl_cert_file'] == '')
{
$row_ipsandports['ssl_cert_file'] = $this->settings['system']['ssl_cert_file']; $row_ipsandports['ssl_cert_file'] = $this->settings['system']['ssl_cert_file'];
} }
if ($row_ipsandports['ssl_key_file'] == '') {
if($row_ipsandports['ssl_key_file'] == '')
{
$row_ipsandports['ssl_key_file'] = $this->settings['system']['ssl_key_file']; $row_ipsandports['ssl_key_file'] = $this->settings['system']['ssl_key_file'];
} }
if ($row_ipsandports['ssl_ca_file'] == '') {
if($row_ipsandports['ssl_ca_file'] == '')
{
$row_ipsandports['ssl_ca_file'] = $this->settings['system']['ssl_ca_file']; $row_ipsandports['ssl_ca_file'] = $this->settings['system']['ssl_ca_file'];
} }
if ($row_ipsandports['ssl_cert_file'] != '') {
if($row_ipsandports['ssl_cert_file'] != '')
{
$this->nginx_data[$vhost_filename].= "\t" . 'ssl on;' . "\n"; $this->nginx_data[$vhost_filename].= "\t" . 'ssl on;' . "\n";
$this->nginx_data[$vhost_filename].= "\t" . 'ssl_certificate ' . makeCorrectFile($row_ipsandports['ssl_cert_file']) . ';' . "\n"; $this->nginx_data[$vhost_filename].= "\t" . 'ssl_certificate ' . makeCorrectFile($row_ipsandports['ssl_cert_file']) . ';' . "\n";
}
if ($row_ipsandports['ssl_key_file'] != '') { if ($row_ipsandports['ssl_key_file'] != '') {
$this->nginx_data[$vhost_filename].= "\t" . 'ssl_certificate_key ' .makeCorrectFile($row_ipsandports['ssl_key_file']) . ';' . "\n"; $this->nginx_data[$vhost_filename].= "\t" . 'ssl_certificate_key ' .makeCorrectFile($row_ipsandports['ssl_key_file']) . ';' . "\n";
} }
if ($row_ipsandports['ssl_ca_file'] != '') { if ($row_ipsandports['ssl_ca_file'] != '') {
$this->nginx_data[$vhost_filename].= 'ssl_client_certificate ' . makeCorrectFile($row_ipsandports['ssl_ca_file']) . ';' . "\n"; $this->nginx_data[$vhost_filename].= 'ssl_client_certificate ' . makeCorrectFile($row_ipsandports['ssl_ca_file']) . ';' . "\n";
} }
} }
}
$this->nginx_data[$vhost_filename].= "\t".'location ~ \.php$ {'."\n"; $this->nginx_data[$vhost_filename].= "\t".'location ~ \.php$ {'."\n";
$this->nginx_data[$vhost_filename].= "\t\t".' if (!-f $request_filename) {'."\n"; $this->nginx_data[$vhost_filename].= "\t\t".' if (!-f $request_filename) {'."\n";
@@ -287,7 +270,7 @@ class nginx
$this->nginx_data[$vhost_filename].= '}' . "\n\n"; $this->nginx_data[$vhost_filename].= '}' . "\n\n";
// End of Froxlor server{}-part // End of Froxlor server{}-part
}
$this->createNginxHosts($row_ipsandports['ip'], $row_ipsandports['port'], $row_ipsandports['ssl'], $vhost_filename); $this->createNginxHosts($row_ipsandports['ip'], $row_ipsandports['port'], $row_ipsandports['ssl'], $vhost_filename);
} }
@@ -420,14 +403,8 @@ class nginx
// open vhost-container // open vhost-container
$vhost_content.= 'server { ' . "\n"; $vhost_content.= 'server { ' . "\n";
/** // listening statement (required)
* listening statement (required)
* edit: as of #1076 this is optional but should be deactivated with CARE as it
* might break a lot
*/
if ($ipsandport['listen_statement'] == '1') {
$vhost_content.= "\t" . 'listen ' . $ipport . ';' . "\n"; $vhost_content.= "\t" . 'listen ' . $ipport . ';' . "\n";
}
// get all server-names // get all server-names
$vhost_content.= $this->getServerNames($domain); $vhost_content.= $this->getServerNames($domain);