Changes

From SME Server
Jump to navigationJump to search
528 bytes removed ,  07:27, 16 April 2018
Undo revision 34618 by Calisun (talk)
Line 156: Line 156:     
   {
 
   {
    use esmith::AccountsDB;
+
      use esmith::AccountsDB;
    my $accounts = esmith::AccountsDB->open_ro;
+
      my $accounts = esmith::AccountsDB->open_ro;
 
+
 
    use esmith::DomainsDB;
+
      use esmith::DomainsDB;
    my $domains = esmith::DomainsDB->open_ro;
+
      my $domains = esmith::DomainsDB->open_ro;
 
+
 
    $OUT = "";
+
      $OUT = "";
 
+
 
    my $ibay = $virtualHostContent;
+
      my $ibay = $virtualHostContent;
    my $basedir = "/home/e-smith/files/ibays/$ibay";
+
      my $basedir = "/home/e-smith/files/ibays/$ibay";
    my $cgiBin = $accounts->get_prop($ibay, "CgiBin") || "";
+
      my $cgiBin = $accounts->get_prop($ibay, "CgiBin") || "";
    my $ssl_domain = $accounts->get_prop($ibay, "SSL") || "disabled";
+
 
 
+
      $OUT .= "    DocumentRoot        $basedir/html\n";
    $OUT .= "    DocumentRoot        $basedir/html\n";
+
    
 
+
      if ($cgiBin)
        my $SSLPort = $modSSL{'TCPPort'} || '443';
+
      {
        if (( $port ne $SSLPort ) && ( $ssl_domain eq 'enabled'))
+
  $OUT .= "    ScriptAlias /cgi-bin $basedir/cgi-bin\n";
        {
+
      }
        my $portspec = ($SSLPort eq 443) ? "" : ":$SSLPort"; 
+
      else
        $OUT .= "    RewriteEngine on\n";
+
      {
        $OUT .= "   RewriteRule ^/(.*|\$) https://%{HTTP_HOST}${portspec}/\$1 [R,L]\n";
+
  $OUT .=
        }
+
  "    # To add cgi-bin ScriptAlias for this i-bay, run:\n"
 
+
        . "    #  /sbin/e-smith/db accounts setprop $ibay CgiBin "
    if ($cgiBin)
+
      . "enabled\n"
    {
+
        . "    #  /sbin/e-smith/signal-event console-save\n";
$OUT .= "    ScriptAlias /cgi-bin $basedir/cgi-bin\n";
+
      }
    }
+
      $OUT .= "#   Alias      /files  $basedir/files\n";
    else
+
     
    {
+
      if (($domains->get_prop($virtualHost, 'SystemPrimaryDomain') || 'no')
$OUT .=
+
            eq 'yes')
"    # To add cgi-bin ScriptAlias for this i-bay, run:\n"
+
      {
      . "    #  /sbin/e-smith/db accounts setprop $ibay CgiBin "
+
  my @ibays = $accounts->ibays;
    . "enabled\n"
+
  foreach my $ibay (@ibays)
      . "    #  /sbin/e-smith/signal-event console-save\n";
+
  {
    }
+
      my $key = $ibay->key;
    $OUT .= " #   Alias      /files  $basedir/files\n";
+
      next if $key eq $virtualHostContent;
   
+
      my $basedir = "/home/e-smith/files/ibays/$key";
    if (($domains->get_prop($virtualHost, 'SystemPrimaryDomain') || 'no')
+
      my $cgiBin = $ibay->prop("CgiBin") || "";
        eq 'yes')
+
      my $name = $ibay->prop("Name") || "";
    {
+
     
my @ibays = $accounts->ibays;
+
      $OUT .= "\n";
foreach my $ibay (@ibays)
+
      $OUT .= "    # $key ibay ($name)\n";
{
+
      $OUT .= "\n";
    my $key = $ibay->key;
+
     
    next if $key eq $virtualHostContent;
+
      if ($cgiBin)
    my $basedir = "/home/e-smith/files/ibays/$key";
+
      {
    my $cgiBin = $ibay->prop("CgiBin") || "";
+
  $OUT .= "    ScriptAlias /$key/cgi-bin $basedir/cgi-bin\n";
    my $name = $ibay->prop("Name") || "";
+
      }
   
+
      else
    $OUT .= "\n";
+
      {
    $OUT .= "    # $key ibay ($name)\n";
+
  $OUT .=  
    $OUT .= "\n";
+
      "    # To add cgi-bin ScriptAlias for this i-bay, run:\n"
    my $SSLPort = $modSSL{'TCPPort'} || '443';
+
      . "    #  /sbin/e-smith/db accounts setprop $key CgiBin "
 
+
  . "enabled\n"
    if (( $port ne $SSLPort ) && (($ibay->prop('SSL') || 'disabled') eq 'enabled')){
+
      . "    #  /sbin/e-smith/signal-event console-save\n";
        my $portspec = ($SSLPort eq 443) ? "" : ":$SSLPort"; 
+
      }
$OUT .= "    RewriteEngine on\n";
+
 
$OUT .= "   RewriteRule ^/$key(/.*|\$) https://%{HTTP_HOST}${portspec}/$key\$1 \[L,R\]\n";
+
      $OUT .= "    Alias      /$key/files  $basedir/files\n";
    }
+
 
    if ($cgiBin)
+
      # Make sure this one is last since it's a prefix of the above
    {
+
      # aliases. If we put it first, it would get expanded before the
$OUT .= "    ScriptAlias /$key/cgi-bin $basedir/cgi-bin\n";
+
      # other aliases, creating problems.
    }
+
 
    else
+
      $OUT .= "    Alias      /$key        $basedir/html\n";
    {
+
  }
$OUT .=  
+
  $OUT .= "    # No ibays in system\n" unless @ibays;
    "    # To add cgi-bin ScriptAlias for this i-bay, run:\n"
+
      }
    . "    #  /sbin/e-smith/db accounts setprop $key CgiBin "
+
  }
. "enabled\n"
  −
    . "    #  /sbin/e-smith/signal-event console-save\n";
  −
    }
  −
 
  −
    $OUT .= "    Alias      /$key/files  $basedir/files\n";
  −
 
  −
    # Make sure this one is last since it's a prefix of the above
  −
    # aliases. If we put it first, it would get expanded before the
  −
    # other aliases, creating problems.
  −
 
  −
    $OUT .= "    Alias      /$key        $basedir/html\n";
  −
}
  −
$OUT .= "    # No ibays in system\n" unless @ibays;
  −
    }
  −
}
  −
 
   
    
 
    
 
    
 
    
175

edits

Navigation menu