Changes

From SME Server
Jump to navigationJump to search
679 bytes added ,  07:45, 16 April 2018
Notice about updated template code
Line 3: Line 3:  
Following Step-by-Step instructions are for installing wordpress in an i-Bay of SME Server.
 
Following Step-by-Step instructions are for installing wordpress in an i-Bay of SME Server.
 
Instructions below will show you how to install both single wordpress install and Multisite.
 
Instructions below will show you how to install both single wordpress install and Multisite.
Instructions were originally written and tested on SME 8.x, but should function fine in any future versions of SME Server.  
+
Instructions were originally written and tested on SME 8.x,(*) but should function fine in any future versions of SME Server.  
 +
 
 +
(*) If you have followed this How-To prior to April, 15 2018, please update your template described in Part 2, Section 2. 
      Line 154: Line 156:  
Contents of the text file:
 
Contents of the text file:
    +
<syntaxhighlight>
 +
{
 +
    use esmith::AccountsDB;
 +
    my $accounts = esmith::AccountsDB->open_ro;
 +
 +
    use esmith::DomainsDB;
 +
    my $domains = esmith::DomainsDB->open_ro;
 +
 +
    $OUT = "";
 +
 +
    my $ibay = $virtualHostContent;
 +
    my $basedir = "/home/e-smith/files/ibays/$ibay";
 +
    my $cgiBin = $accounts->get_prop($ibay, "CgiBin") || "";
 +
    my $ssl_domain = $accounts->get_prop($ibay, "SSL") || "disabled";
   −
  {
+
    $OUT .= "    DocumentRoot        $basedir/html\n";
      use esmith::AccountsDB;
  −
      my $accounts = esmith::AccountsDB->open_ro;
  −
 
  −
      use esmith::DomainsDB;
  −
      my $domains = esmith::DomainsDB->open_ro;
  −
 
  −
      $OUT = "";
  −
 
  −
      my $ibay = $virtualHostContent;
  −
      my $basedir = "/home/e-smith/files/ibays/$ibay";
  −
      my $cgiBin = $accounts->get_prop($ibay, "CgiBin") || "";
  −
 
  −
      $OUT .= "    DocumentRoot        $basedir/html\n";
  −
 
  −
      if ($cgiBin)
  −
      {
  −
  $OUT .= "    ScriptAlias /cgi-bin $basedir/cgi-bin\n";
  −
      }
  −
      else
  −
      {
  −
  $OUT .=
  −
  "    # To add cgi-bin ScriptAlias for this i-bay, run:\n"
  −
        . "    #  /sbin/e-smith/db accounts setprop $ibay CgiBin "
  −
      . "enabled\n"
  −
        . "    #  /sbin/e-smith/signal-event console-save\n";
  −
      }
  −
      $OUT .= "#    Alias      /files  $basedir/files\n";
  −
     
  −
      if (($domains->get_prop($virtualHost, 'SystemPrimaryDomain') || 'no')
  −
            eq 'yes')
  −
      {
  −
  my @ibays = $accounts->ibays;
  −
  foreach my $ibay (@ibays)
  −
  {
  −
      my $key = $ibay->key;
  −
      next if $key eq $virtualHostContent;
  −
      my $basedir = "/home/e-smith/files/ibays/$key";
  −
      my $cgiBin = $ibay->prop("CgiBin") || "";
  −
      my $name = $ibay->prop("Name") || "";
  −
     
  −
      $OUT .= "\n";
  −
      $OUT .= "    # $key ibay ($name)\n";
  −
      $OUT .= "\n";
  −
     
  −
      if ($cgiBin)
  −
      {
  −
  $OUT .= "    ScriptAlias /$key/cgi-bin $basedir/cgi-bin\n";
  −
      }
  −
      else
  −
      {
  −
  $OUT .=
  −
      "    # 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;
  −
      }
  −
  }
  −
 
  −
 
     −
To activate the custom template:
+
        my $SSLPort = $modSSL{'TCPPort'} || '443';
 +
        if (( $port ne $SSLPort ) && ( $ssl_domain eq 'enabled'))
 +
        {
 +
        my $portspec = ($SSLPort eq 443) ? "" : ":$SSLPort"; 
 +
        $OUT .= "    RewriteEngine on\n";
 +
        $OUT .= "    RewriteRule ^/(.*|\$) https://%{HTTP_HOST}${portspec}/\$1 [R,L]\n";
 +
        }
 +
 
 +
    if ($cgiBin)
 +
    {
 +
$OUT .= "    ScriptAlias /cgi-bin $basedir/cgi-bin\n";
 +
    }
 +
    else
 +
    {
 +
$OUT .=
 +
"    # To add cgi-bin ScriptAlias for this i-bay, run:\n"
 +
      . "    #  /sbin/e-smith/db accounts setprop $ibay CgiBin "
 +
    . "enabled\n"
 +
      . "    #  /sbin/e-smith/signal-event console-save\n";
 +
    }
 +
    $OUT .= " #  Alias      /files  $basedir/files\n";
 +
   
 +
    if (($domains->get_prop($virtualHost, 'SystemPrimaryDomain') || 'no')
 +
        eq 'yes')
 +
    {
 +
my @ibays = $accounts->ibays;
 +
foreach my $ibay (@ibays)
 +
{
 +
    my $key = $ibay->key;
 +
    next if $key eq $virtualHostContent;
 +
    my $basedir = "/home/e-smith/files/ibays/$key";
 +
    my $cgiBin = $ibay->prop("CgiBin") || "";
 +
    my $name = $ibay->prop("Name") || "";
 +
   
 +
    $OUT .= "\n";
 +
    $OUT .= "    # $key ibay ($name)\n";
 +
    $OUT .= "\n";
 +
    my $SSLPort = $modSSL{'TCPPort'} || '443';
 +
 
 +
    if (( $port ne $SSLPort ) && (($ibay->prop('SSL') || 'disabled') eq 'enabled')){
 +
        my $portspec = ($SSLPort eq 443) ? "" : ":$SSLPort"; 
 +
$OUT .= "    RewriteEngine on\n";
 +
$OUT .= "    RewriteRule ^/$key(/.*|\$) https://%{HTTP_HOST}${portspec}/$key\$1 \[L,R\]\n";
 +
    }
 +
    if ($cgiBin)
 +
    {
 +
$OUT .= "    ScriptAlias /$key/cgi-bin $basedir/cgi-bin\n";
 +
    }
 +
    else
 +
    {
 +
$OUT .=
 +
    "    # 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;
 +
    }
 +
}
 +
 
 +
</syntaxhighlight>To activate the custom template:
    
   signal-event post-upgrade; signal-event reboot
 
   signal-event post-upgrade; signal-event reboot
175

edits

Navigation menu