Difference between revisions of "Wordpress Multisite"

From SME Server
Jump to navigationJump to search
 
(96 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
This is a copy of instructions originally created and published by Calisun: [[User_talk:Calisun|http://wiki.contribs.org/User_talk:Calisun]]
 
This is a copy of instructions originally created and published by Calisun: [[User_talk:Calisun|http://wiki.contribs.org/User_talk:Calisun]]
==Introduction==
 
Following Step-by-Step instructions are for installing wordpress in an i-Bay of SME 8.x
 
  
 +
<tabs container>
 +
<tab name="For SME 9">
  
   Notice: When installing ANY web application in an iBay of the SME server, there is always a danger of
+
{{Note box|msg=(*) If you have followed this How-To prior to April 15 2018, please update your template to the one described in Part 2, Section 2.
 +
(Updating template is only required if Part 1 Section C was completed)}}
 +
 
 +
<div class="noautonum">__TOC__</div>
 +
 
 +
=='''Introduction'''==
 +
'''Instructions were originally written and tested on SME 8.x,(*) and later updated to work with SME 9.0 (See yellow Note Above). These instructions were Not tested in SME 10.0 (SME 10.0 instructions to follow later)'''
 +
 
 +
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 site and Multisite versions. All steps build on each other, so if your ultimate goal is step C, Step A and B must be done first.
 +
 
 +
After following step(s) below you will have a fully functional Wordpress site <u>with the exception of automatic updating</u>. Automatic Updating requires FTP access to the core files. You can manage FTP access to iBays with the contrib located [[FTP Access to Ibays|HERE]]. <u>Alternatively</u>, auto updates can be left off and: Wordpress system, plugins and themes can all be updated manually by following instructions from [https://www.wordfence.com/learn/how-to-manually-upgrade-wordpress-themes-and-plugins/ HERE]
 +
 
 +
 
 +
The instructions are [[:Category:Medium|Medium difficulty]] and assume that you know how to:
 +
 
 +
*Create an ibay and create a domain using [[SME_Server:Documentation:Administration_Manual:Chapter14|server-manager]]
 +
*Upload files to server using FTP. For ease of use I recommend GUI program, like [https://sourceforge.net/projects/filezilla/ Filezilla] or [http://winscp.net/eng/index.php WinSCP]
 +
*That you know how to issue a command to server using [http://www.putty.org/ PuTTY] or similar program. For ease of use I recommend [[Shellinabox|ShellinaBox]]
 +
*That you know how to create a database and database user. For ease of use I recommend [[PHPMyAdmin]]
 +
 
 +
 
 +
   Notice: When installing ANY web application in an iBay of the SME server, there is always a danger of internal network
 
   users changing (intentionally or accidentally) files in the application iBay.  
 
   users changing (intentionally or accidentally) files in the application iBay.  
   If there is a possible security issue with users, it is recommended to install wordpress
+
    
  contribution from here: http://wiki.contribs.org/Category:Contrib
+
   To mitigate the risk, administrators should make use of Groups to only allow authorized users to have access to ibay files via samba/Windows filesharing.
   If there is no user security issue, or the server only has admin access, you may continue.
 
  Administrators should make use of Groups to only allow authorised users to have access to ibay files via samba/Windows
 
  filesharing.
 
  
== PART ONE: ==
+
=='''PART ONE:'''==
  
'''A) Wordpress install in an iBay of SME server:'''
+
===A) Wordpress install in an iBay of SME server:===
  
 
+
'''<u>A1)</u>''' Create an iBay in which you wish to install wordpress on.
A1) Create an iBay in which you wish to install wordpress on.
 
  
 
When creating the iBay in server-manager:
 
When creating the iBay in server-manager:
Line 25: Line 43:
 
     * - Under Public access via web, choose Entire internet without password.
 
     * - Under Public access via web, choose Entire internet without password.
 
     * - Enable Execution of dynamic content.  
 
     * - Enable Execution of dynamic content.  
 +
    * - If you enable "Force secure connections" all connections will be forced to HTTPS
 +
        (If "Force secure connections" is enabled, All Viewers will receive "Problem with websites security certificate" error message, unless you
 +
        install trusted certificates.
 +
        You can ether purchase commercial certificate, which is recommended for large retail sites, or you can use free LetsEncrypt Contrib, See [[Letsencrypt|HERE]])
  
 
+
'''<u>A2)</u>''' Issue a following command to enable PHP temporary upload folder in that iBay.(Change "iBay" to the name of your ibay and remove quote marks). Note you may have to add additional directories beyond what is shown here depending on the plugins you select. Take a look at /var/log/messages if something isn't working. PHP will issue warnings to that log file. Additional directories are added to the db accounts statement below by separating them with a colon.
A2) Issue a following command to enable PHP temporary upload folder in that iBay.(Change "iBay" to the name of your ibay and remove quote marks)
 
 
 
 
   db accounts setprop "iBay" PHPBaseDir /home/e-smith/files/ibays/"iBay":/tmp
 
   db accounts setprop "iBay" PHPBaseDir /home/e-smith/files/ibays/"iBay":/tmp
 
   signal-event ibay-modify "iBay"
 
   signal-event ibay-modify "iBay"
  
  
A3) Issue a following command to enable Symlinks in that iBay.(Change "iBay" to the name of your ibay and remove quote marks)
+
'''<u>A3)</u>''' Issue a following command to enable Symlinks in that iBay.(Change "iBay" to the name of your ibay and remove quote marks)
  
 
   db accounts setprop "iBay" AllowOverride all
 
   db accounts setprop "iBay" AllowOverride all
Line 40: Line 60:
 
   signal-event ibay-modify "iBay"
 
   signal-event ibay-modify "iBay"
  
A4) Create mysql database and database user for wordpress to use. Make sure database user has all the privileges to the database you have created. For security reasons, allow access to the database from localhost only.
+
'''<u>A4)</u>''' Create mysql database and database user for wordpress to use *(1,2). Make sure database user has all the privileges to the database you have created. For security reasons, allow access to the database from localhost only.
  
A5) Download latest version from www.wordpress.org to your computer and unzip it. Upload unzipped wordpress to desired ibay/html
+
'''<u>A5)</u>''' Download latest version from www.wordpress.org to your computer and unzip it. Upload unzipped wordpress to desired "iBay"/html
  
  
A6) In the SME admin panel, Create a new domain and point it to the iBay where the wordpress is installed.
+
'''<u>A6)</u>''' In the SME server-manager, Create a new domain and point it to the iBay where the wordpress is installed. (Assuming you have already registered a domain with domain registrar and pointed it to your server IP)
  
  
A7) Point your web browser to your domain and go through the installation process.
 
  
    * If you want to have a single blog (personal blog) on one domain, you are done.  
+
'''<u>A7)</u>''' Point your web browser to your domain and go through the installation process.++<blockquote>++ Wordpress version 5.1+ requires PHP 5.6.20 but default PHP install on SME Server 9.2 is 5.3.3</blockquote><blockquote>You will need to install contrib: [[PHP Software Collections]] and assign your iBay PHP version <s>5.6</s> 7.1 or higher (PHP 5.6 and 7.0 are already EOL, 7.1 EOL Dec 2019). If you don't complete this step, you will get a blank screen when doing step '''A7'''</blockquote>
 +
    '''!! * FOR SECURITY REASONS:'''
 +
1) Never use "admin" for admin user name, that is the first thing hackers try
 +
2) For wordpress database, change default prefix (inside wp-config.php), which is "wp_" (change WP, leave the underscore, it will make tables easier to read).
 +
    Changing the table prefix to a random string makes it difficult if not impossible for a hacker to execute remote SQL injection attacks.
 +
 
 +
'''<u>A8)</u>''' Enable the wp-content/uploads folder to be writeable by the webserver process (Change "iBay" to the name of your ibay and remove quote marks)
  
 +
(If your WP is installed directly in .../ibays/"iBay"/html/ , you can ignore/remove "wpsitepath", if you have WP installed in sub-directory of /html/"wpsitepath", change "wpsitepath" to the name of your sub-directory and remove quote marks)
 +
chown -R admin:shared /home/e-smith/files/ibays/"iBay"/html/"wpsitepath"
 +
mkdir -p /home/e-smith/files/ibays/"iBay"/html/"wpsitepath"/wp-content/uploads
 +
chown -R admin:shared /home/e-smith/files/ibays/"iBay"/html/"wpsitepath"/wp-content
 +
chown -R apache:www /home/e-smith/files/ibays/"iBay"/html/"wpsitepath"/wp-content/uploads
  
'''B) Enable a Multisite:'''
+
    * If you want to have a single blog (personal blog) on one domain, you are done.
  
 +
===B) Enable a Multisite:  (several blogs under one domain)===
  
B1) Open wp-config.php and add the folowing code:
+
'''<u>B1)</u>''' Open wp-config.php and add the folowing code:
  
  
Line 66: Line 97:
  
  
B2) Log into your wordpress Dashboard
+
'''<u>B2)</u>''' Log into your wordpress Dashboard
  
 
Under: Tools, Network
 
Under: Tools, Network
Line 75: Line 106:
 
     * NOTE- By default SME Server does not support Wildcard Subdomains, so you will need to choose Subfolder.  
 
     * NOTE- By default SME Server does not support Wildcard Subdomains, so you will need to choose Subfolder.  
 
If you want or need to use a Subdomain, you will need to create a custom template for SME Server to support Wildcard Subdomains.  
 
If you want or need to use a Subdomain, you will need to create a custom template for SME Server to support Wildcard Subdomains.  
For instructions on how to create custom template for Wildcard Subdomains, go below to PART TWO for instructions.  
+
For instructions on how to create custom template for Wildcard Subdomains, go below to <u>PART TWO #1</u> for instructions.  
  
  
B3) After you click install, you will be taken to a "Create a Network of WordPress Sites" screen
+
'''<u>B3)</u>''' After you click install, you will be taken to a "Create a Network of WordPress Sites" screen
  
 
Make sure you follow ALL 3 steps.
 
Make sure you follow ALL 3 steps.
Line 84: Line 115:
 
     * If you are planning to run several blogs under one domain, than you are done.  
 
     * If you are planning to run several blogs under one domain, than you are done.  
  
 +
===C) To run several Domains on one wordpress install:===
  
'''C) To run several Domains on one wordpress install:'''
+
'''<u>C1)</u>''' You will need to install Wordpress Domain Mapping plugin.
 
 
 
 
C1) You will need to install Wordpress Domain Mapping plugin.
 
  
 
Find it here: http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/
 
Find it here: http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/
Line 95: Line 124:
  
  
C2) Create all your domains in the SME server-manager and point them to the iBay where you installed wordpress.
+
'''<u>C2)</u>''' Create all your domains in the SME server-manager and point them to the iBay where you installed wordpress. (Assuming you have already registered your domains with domain registrar and pointed them to your server IP)
  
C3) create new sites in wordpress dashboard that will handle new domains created in step 2
+
'''<u>C3)</u>''' create new sites in wordpress dashboard that will handle new domains created in step C2
  
SME Specific Change:
+
'''!! SME Specific Change: !!'''
 +
(required in order for multisite to display images properly)
  
SME Server and wordpress use the same name "files" for totally different folders, and that is causing issues displaying images inside blogs that use Domain mapping. In order for the images to show up correctly, we need to create a custom template to fix the conflict. Go below to PART TWO for instruction on how to create the custom template.
+
SME Server and wordpress use the same folder name "files" for totally different folders in different locations. That conflict is causing problems displaying images inside blogs that use Domain mapping. In order for the images to show up correctly, we need to create a custom template to fix the conflict. Go below to <u>PART TWO #2</u> for instruction on how to create the custom template.
  
== PART TWO: ==
+
=='''PART TWO:'''==
  
A) Custom Templates
+
===Custom Templates===
 
 
 
 
A1) Enable Wildcard Subdomains
 
  
 +
===1) Enable Wildcard Subdomains===
 
Inside following folder location:
 
Inside following folder location:
  
Line 121: Line 149:
  
 
   ServerAlias *.{$virtualHost}
 
   ServerAlias *.{$virtualHost}
 
  
 
To activate the custom template:
 
To activate the custom template:
  
   signal-event post-upgrade; signal-event reboot
+
   expand-template /etc/httpd/conf/httpd.conf
 +
  service httpd-e-smith restart
  
 +
You will need then to add the desired subdomain pointing to your SME using your registrar, or create a wildcard if supported on your registrar interface.
  
A2) Fix Image display problem.
+
===2) Fix Image display problem in multisite installation.===
 
 
 
Inside following folder location:
 
Inside following folder location:
  
Line 140: Line 168:
 
Contents of the text file:
 
Contents of the text file:
  
 +
<syntaxhighlight>
 +
{
 +
    use esmith::AccountsDB;
 +
    my $accounts = esmith::AccountsDB->open_ro;
  
  {
+
    use esmith::DomainsDB;
      use esmith::AccountsDB;
+
    my $domains = esmith::DomainsDB->open_ro;
      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:
+
    $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";
 +
 
 +
        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
  
 +
===3) Increase file size limit in PHP.===
 +
This step is not necessary, you can do it if you need to upload files/ pictures larger than the default settings in php.
 +
 +
(Wordpress also has its own user upload limit settings, which needs to be changed inside wordpress dashboard, separately from PHP settings)
 +
 +
(Below can be done again if for some reason values need to be changed)
 +
 +
 +
++ This code makes changes to default PHP installation. If you are using [[PHP Software Collections]] (As suggested in step '''A7''') <u>see below</u>.
 +
  db configuration setprop php MemoryLimit 128M
 +
  db configuration setprop php PostMaxSize 112M
 +
  db configuration setprop php UploadMaxFilesize 96M
 +
  expand-template /etc/php.ini
 +
  sv t httpd-e-smith
 +
 +
++ If you are using [[PHP Software Collections]], use this code. If you are using different PHP-SCL version other than php71, you can replace that section with version you are using for your Wordpress iBay.<syntaxhighlight>
 +
db configuration setprop php71 MemoryLimit 128M
 +
db configuration setprop php71 PostMaxSize 112M
 +
db configuration setprop php71 UploadMaxFilesize 96M
 +
signal-event php-update
 +
</syntaxhighlight>
 +
 +
Side note: To see how to change file size limits for other applications, see here: http://wiki.contribs.org/Email#Set_max_email_size
  
 
Good Luck
 
Good Luck
Line 222: Line 286:
 
And have fun with your new Wordpress install.  
 
And have fun with your new Wordpress install.  
  
----
+
CaliSun
 +
 
 +
</tab>
 +
<tab name="For SME 10">
 +
 
 +
SME 10.0 instructions to follow later
 +
 
 +
</tab>
 +
</tabs>
 +
 
 +
 
 
[[Category:Howto]]
 
[[Category:Howto]]
 +
[[Category:Medium]]

Latest revision as of 03:54, 16 April 2022

This is a copy of instructions originally created and published by Calisun: http://wiki.contribs.org/User_talk:Calisun


Important.png Note:
(*) If you have followed this How-To prior to April 15 2018, please update your template to the one described in Part 2, Section 2.

(Updating template is only required if Part 1 Section C was completed)


Introduction

Instructions were originally written and tested on SME 8.x,(*) and later updated to work with SME 9.0 (See yellow Note Above). These instructions were Not tested in SME 10.0 (SME 10.0 instructions to follow later)

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 site and Multisite versions. All steps build on each other, so if your ultimate goal is step C, Step A and B must be done first.

After following step(s) below you will have a fully functional Wordpress site with the exception of automatic updating. Automatic Updating requires FTP access to the core files. You can manage FTP access to iBays with the contrib located HERE. Alternatively, auto updates can be left off and: Wordpress system, plugins and themes can all be updated manually by following instructions from HERE


The instructions are Medium difficulty and assume that you know how to:

  • Create an ibay and create a domain using server-manager
  • Upload files to server using FTP. For ease of use I recommend GUI program, like Filezilla or WinSCP
  • That you know how to issue a command to server using PuTTY or similar program. For ease of use I recommend ShellinaBox
  • That you know how to create a database and database user. For ease of use I recommend PHPMyAdmin


 Notice: When installing ANY web application in an iBay of the SME server, there is always a danger of internal network
 users changing (intentionally or accidentally) files in the application iBay. 
 
 To mitigate the risk, administrators should make use of Groups to only allow authorized users to have access to ibay files via samba/Windows filesharing.

PART ONE:

A) Wordpress install in an iBay of SME server:

A1) Create an iBay in which you wish to install wordpress on.

When creating the iBay in server-manager:

   * - Change the group from Admin to everyone. - This will allow users to create blogs and post pictures without having permission issues.
   * - Change User access to Write=group, Read=everyone
   * - Under Public access via web, choose Entire internet without password.
   * - Enable Execution of dynamic content. 
   * - If you enable "Force secure connections" all connections will be forced to HTTPS
       (If "Force secure connections" is enabled, All Viewers will receive "Problem with websites security certificate" error message, unless you
        install trusted certificates. 
        You can ether purchase commercial certificate, which is recommended for large retail sites, or you can use free LetsEncrypt Contrib, See HERE) 

A2) Issue a following command to enable PHP temporary upload folder in that iBay.(Change "iBay" to the name of your ibay and remove quote marks). Note you may have to add additional directories beyond what is shown here depending on the plugins you select. Take a look at /var/log/messages if something isn't working. PHP will issue warnings to that log file. Additional directories are added to the db accounts statement below by separating them with a colon.

  db accounts setprop "iBay" PHPBaseDir /home/e-smith/files/ibays/"iBay":/tmp
  signal-event ibay-modify "iBay"


A3) Issue a following command to enable Symlinks in that iBay.(Change "iBay" to the name of your ibay and remove quote marks)

  db accounts setprop "iBay" AllowOverride all
  db accounts setprop "iBay" FollowSymLinks enabled
  db accounts setprop "iBay" Indexes disabled
  signal-event ibay-modify "iBay"

A4) Create mysql database and database user for wordpress to use *(1,2). Make sure database user has all the privileges to the database you have created. For security reasons, allow access to the database from localhost only.

A5) Download latest version from www.wordpress.org to your computer and unzip it. Upload unzipped wordpress to desired "iBay"/html


A6) In the SME server-manager, Create a new domain and point it to the iBay where the wordpress is installed. (Assuming you have already registered a domain with domain registrar and pointed it to your server IP)


A7) Point your web browser to your domain and go through the installation process.++

++ Wordpress version 5.1+ requires PHP 5.6.20 but default PHP install on SME Server 9.2 is 5.3.3

You will need to install contrib: PHP Software Collections and assign your iBay PHP version 5.6 7.1 or higher (PHP 5.6 and 7.0 are already EOL, 7.1 EOL Dec 2019). If you don't complete this step, you will get a blank screen when doing step A7

   !! * FOR SECURITY REASONS:
1) Never use "admin" for admin user name, that is the first thing hackers try
2) For wordpress database, change default prefix (inside wp-config.php), which is "wp_" (change WP, leave the underscore, it will make tables easier to read). 
   Changing the table prefix to a random string makes it difficult if not impossible for a hacker to execute remote SQL injection attacks.

A8) Enable the wp-content/uploads folder to be writeable by the webserver process (Change "iBay" to the name of your ibay and remove quote marks)

(If your WP is installed directly in .../ibays/"iBay"/html/ , you can ignore/remove "wpsitepath", if you have WP installed in sub-directory of /html/"wpsitepath", change "wpsitepath" to the name of your sub-directory and remove quote marks)

chown -R admin:shared /home/e-smith/files/ibays/"iBay"/html/"wpsitepath"
mkdir -p /home/e-smith/files/ibays/"iBay"/html/"wpsitepath"/wp-content/uploads
chown -R admin:shared /home/e-smith/files/ibays/"iBay"/html/"wpsitepath"/wp-content
chown -R apache:www /home/e-smith/files/ibays/"iBay"/html/"wpsitepath"/wp-content/uploads
   * If you want to have a single blog (personal blog) on one domain, you are done. 

B) Enable a Multisite: (several blogs under one domain)

B1) Open wp-config.php and add the folowing code:


  define('WP_ALLOW_MULTISITE', true);

- just above

  define('DB_NAME', .....


B2) Log into your wordpress Dashboard

Under: Tools, Network


Choose desired settings and click on Install

   * NOTE- By default SME Server does not support Wildcard Subdomains, so you will need to choose Subfolder. 

If you want or need to use a Subdomain, you will need to create a custom template for SME Server to support Wildcard Subdomains. For instructions on how to create custom template for Wildcard Subdomains, go below to PART TWO #1 for instructions.


B3) After you click install, you will be taken to a "Create a Network of WordPress Sites" screen

Make sure you follow ALL 3 steps.

   * If you are planning to run several blogs under one domain, than you are done. 

C) To run several Domains on one wordpress install:

C1) You will need to install Wordpress Domain Mapping plugin.

Find it here: http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/

Just follow installation instructions from the plugin download site.


C2) Create all your domains in the SME server-manager and point them to the iBay where you installed wordpress. (Assuming you have already registered your domains with domain registrar and pointed them to your server IP)

C3) create new sites in wordpress dashboard that will handle new domains created in step C2

!! SME Specific Change: !! (required in order for multisite to display images properly)

SME Server and wordpress use the same folder name "files" for totally different folders in different locations. That conflict is causing problems displaying images inside blogs that use Domain mapping. In order for the images to show up correctly, we need to create a custom template to fix the conflict. Go below to PART TWO #2 for instruction on how to create the custom template.

PART TWO:

Custom Templates

1) Enable Wildcard Subdomains

Inside following folder location:

  /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/

Create a text file named:

  03ServerAlias

Contents of the text file:

  ServerAlias *.{$virtualHost}

To activate the custom template:

  expand-template /etc/httpd/conf/httpd.conf
  service httpd-e-smith restart

You will need then to add the desired subdomain pointing to your SME using your registrar, or create a wildcard if supported on your registrar interface.

2) Fix Image display problem in multisite installation.

Inside following folder location:

  /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/VirtualHosts/

Create a text file named:

  20IbayContent

Contents of the text file:

{
    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";

        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;
    }
}
To activate the custom template:
  signal-event post-upgrade; signal-event reboot

3) Increase file size limit in PHP.

This step is not necessary, you can do it if you need to upload files/ pictures larger than the default settings in php.

(Wordpress also has its own user upload limit settings, which needs to be changed inside wordpress dashboard, separately from PHP settings)

(Below can be done again if for some reason values need to be changed)


++ This code makes changes to default PHP installation. If you are using PHP Software Collections (As suggested in step A7) see below.

  db configuration setprop php MemoryLimit 128M
  db configuration setprop php PostMaxSize 112M
  db configuration setprop php UploadMaxFilesize 96M
  expand-template /etc/php.ini 
  sv t httpd-e-smith
++ If you are using PHP Software Collections, use this code. If you are using different PHP-SCL version other than php71, you can replace that section with version you are using for your Wordpress iBay.
db configuration setprop php71 MemoryLimit 128M
db configuration setprop php71 PostMaxSize 112M
db configuration setprop php71 UploadMaxFilesize 96M
signal-event php-update

Side note: To see how to change file size limits for other applications, see here: http://wiki.contribs.org/Email#Set_max_email_size

Good Luck

And have fun with your new Wordpress install.

CaliSun

SME 10.0 instructions to follow later