User Tools

Site Tools


computing:wpmultisite

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
computing:wpmultisite [2019/08/08 17:40] – created oemb1905computing:wpmultisite [2019/12/30 02:18] (current) oemb1905
Line 1: Line 1:
  
 +-------------------------------------------
 +  * **wpmultisite** 
 +  * **Jonathan Haack**
 +  * **Haack's Networking**
 +  * **netcmnd@jonathanhaack.com** 
  
-Fellow educators, free software hackers, and other community members. I have begun the #LiDA103 course – and I am posting this new feed to see if syndication is working on it. @lightweight @mackiwg @oemb1905 … additionally, here is a little about myself!+-------------------------------------------
  
-I am a math teacher at SF Community College, do contract work as an IT Consultant at Schaefer IT Consulting under my business DBA Haack’s Networking and serve on three educational non-profit Boards: NM Council of Teachers of Mathematics, NM Partnership for Math & Science Education, and Learning Through Horses. In case I was not busy enough, I am working on an Ed.D. in Educational Leadership at UNM, raising a 5/7 year old son/daughter, and spend time working on Free Software haacktivism, system’s administration, and ways to break down traditional educational barriers on the side. Oh yeah, and I love hiking, backpacking, and playing basketball.+A tutorial for setting up Word Press multisite
  
-I am here because I have a keen interest in integrating Free Software into my own research practices (and already do), utilizing Free Software for educational offerings such as co-work/co-learn spaces, and fomenting transformational educational change in policy that involves back-middle-front end use of Free Software. I have written a little bit about what brought me to #OERu on my primary sysadmin/gnulinux blog, so make sure to check that out.+-------------------------------------------
  
-I have already been challenged by the program in its questionsformally speaking. Likewise, I have begun informal discussions that have challenged me as well. For example, in discussing matters with Dave and Wayne over at the OERu it turned out I found hole in my intermediate WP knowledgeNamelybecause of the scope of my operations in WP, normally small non-profits and simplistic websites (nmctm.org lthsf.org)I had never needed to set up multi-site functionality. It became apparent, however, in the consultation tonight (or really, about 30 minutes afterwards), that this would be essential for what I am working on in regard to one side project of mine. So, I banged it out.+Firstset up self-hosted WP instanceIf you do not know how to set up a self-hosted WP instanceconsider my tutorial Self Hosted WP. Before beginning this tutorialyou should complete [[http://example.com|Apache Survival]] for a proper LAMP/TLS setup and then [[http://example.com|Self-Hosted WP]].  Once you have LAMP, TLS, and a Word Press instance up and running, set up multi-site as follows (adapted and simplified from wpbeginner.com):
  
-First, set up a multi-site WP instance. If you do not know how to set up a self-hosted WP instance, consider my tutorial Self Hosted WP. Once you have WP up and running, set up multi-site as follows (adapted and simplified from wpbeginner.com): +  sudo nano /var/www/site1.com/public_html/wp-config.php
- +
-sudo nano /var/www/site1.com/public_html/wp-config.php+
  
 Then, add the following lines before the end of the .php file. Then, add the following lines before the end of the .php file.
  
-/* Multisite */ +  /* Multisite */ 
-define('WP_ALLOW_MULTISITE', true);+  define('WP_ALLOW_MULTISITE', true);
  
 Once that is done, go to your site1.com/admin and navigate to Tools and select Sub-domains and click Install. Once that is done, edit your wp-config.php file again: Once that is done, go to your site1.com/admin and navigate to Tools and select Sub-domains and click Install. Once that is done, edit your wp-config.php file again:
  
-sudo nano /var/www/site1.com/public_html/wp-config.php+  sudo nano /var/www/site1.com/public_html/wp-config.php
  
-Add the following just below the line you added above:+Add the following just below the line you added above:  
  
-define('MULTISITE', true); +  define('MULTISITE', true); 
-define('SUBDOMAIN_INSTALL', true); +  define('SUBDOMAIN_INSTALL', true); 
-define('DOMAIN_CURRENT_SITE', 'haacksnetworking.com'); +  define('DOMAIN_CURRENT_SITE', 'haacksnetworking.com'); 
-define('PATH_CURRENT_SITE', '/'); +  define('PATH_CURRENT_SITE', '/'); 
-define('SITE_ID_CURRENT_SITE', 1); +  define('SITE_ID_CURRENT_SITE', 1); 
-define('BLOG_ID_CURRENT_SITE', 1);+  define('BLOG_ID_CURRENT_SITE', 1);
  
 Once this is done, edit your .htaccess file as follows (make sure you understand all of this!): Once this is done, edit your .htaccess file as follows (make sure you understand all of this!):
  
-sudo nano /var/www/site1.com/public_html/.htaccess +  sudo nano /var/www/site1.com/public_html/.htaccess 
-RewriteEngine On +   
-RewriteBase / +It should look something like this.  Start with a clean .htaccess if migrating, and add your other rules afterwards. 
-RewriteRule ^index.php$ - [L]add a trailing slash to /wp-admin +   
-RewriteRule ^wp-admin$ wp-admin/ [R=301,L] +  RewriteEngine On 
-RewriteCond %{REQUEST_FILENAME} -f [OR] +  RewriteBase / 
-RewriteCond %{REQUEST_FILENAME} -d +  RewriteRule ^index.php$ - [L]add a trailing slash to /wp-admin 
-RewriteRule ^ - [L] +  RewriteRule ^wp-admin$ wp-admin/ [R=301,L] 
-RewriteRule ^(wp-(content|admin|includes).) $1 [L] +  RewriteCond %{REQUEST_FILENAME} -f [OR] 
-RewriteRule ^(..php)$ $1 [L] +  RewriteCond %{REQUEST_FILENAME} -d 
-RewriteRule . index.php [L] +  RewriteRule ^ - [L] 
-Options -Indexes+  RewriteRule ^(wp-(content|admin|includes).) $1 [L] 
 +  RewriteRule ^(..php)$ $1 [L] 
 +  RewriteRule . index.php [L] 
 +  Options -Indexes
  
 Thirdly, you should already have TLS with a LAMP (or FEMP) stack and if you do not know how, consult my tutorial Apache Survival. Once you have the concept of virtual hosts down, you are ready to go. So, let’s say you have followed that tutorial and set up site1.com and site2.com appropriately. In that case, begin by setting up another virtual host for the desired subdomain for site1.com. (I am assuming that you have Wildcard DNS set up for the primary domain, and for the desired subdomains – if you do not know how to do this, set up an account at afraid.org, point your name servers there, and read-up.) Thirdly, you should already have TLS with a LAMP (or FEMP) stack and if you do not know how, consult my tutorial Apache Survival. Once you have the concept of virtual hosts down, you are ready to go. So, let’s say you have followed that tutorial and set up site1.com and site2.com appropriately. In that case, begin by setting up another virtual host for the desired subdomain for site1.com. (I am assuming that you have Wildcard DNS set up for the primary domain, and for the desired subdomains – if you do not know how to do this, set up an account at afraid.org, point your name servers there, and read-up.)
  
-sudo openssl req -x509 -nodes -days 7305 -newkey rsa:2048 -keyout /etc/ssl/private/subdomain.site1.key -out /etc/ssl/certs/subdomain.site1.crt +  sudo openssl req -x509 -nodes -days 7305 -newkey rsa:2048 -keyout /etc/ssl/private/subdomain.site1.key -out /etc/ssl/certs/subdomain.site1.crt 
-sudo cp /etc/apache2/sites-available/site1.com.conf /etc/apache2/sites-available/subdomain.site1.com.conf +  sudo cp /etc/apache2/sites-available/site1.com.conf /etc/apache2/sites-available/subdomain.site1.com.conf 
-sudo nano /etc/apache2/sites-available/subdomain.site1.com.conf +  sudo nano /etc/apache2/sites-available/subdomain.site1.com.conf 
-sudo cp /etc/apache2/sites-available/site1.com-ssl.conf /etc/apache2/sites-available/subdomain.site1.com-ssl.conf +  sudo cp /etc/apache2/sites-available/site1.com-ssl.conf /etc/apache2/sites-available/subdomain.site1.com-ssl.conf 
-sudo nano /etc/apache2/sites-available/subdomain.site1.com-ssl.conf +  sudo nano /etc/apache2/sites-available/subdomain.site1.com-ssl.conf 
-sudo a2ensite subdomain.site1.com.conf +  sudo a2ensite subdomain.site1.com.conf 
-sudo a2ensite subdomain.site1.com-ssl.conf+  sudo a2ensite subdomain.site1.com-ssl.conf
  
 Okay, now that your self-signed cert and virtual host for the new subdomain are set up, it is now time to set up a formal CA with Let’s Encrypt. This was the primary place I was confused. After looking at Firefox barf at my certificate and re-direct to other sites on my VPS, I finally determined that I needed to add a domain to the certbot command somehow. So, I took a shot and guessed that it might accept a second -d flag. It did, and here is what I executed: Okay, now that your self-signed cert and virtual host for the new subdomain are set up, it is now time to set up a formal CA with Let’s Encrypt. This was the primary place I was confused. After looking at Firefox barf at my certificate and re-direct to other sites on my VPS, I finally determined that I needed to add a domain to the certbot command somehow. So, I took a shot and guessed that it might accept a second -d flag. It did, and here is what I executed:
  
-sudo certbot --authenticator standalone --installer apache -d site1.com -d subdomain1.site1.com -d subdomain2.site1.com --pre-hook "systemctl stop apache2" --post-hook "systemctl start apache2"+  sudo certbot --authenticator standalone --installer apache //-d site1.com -d subdomain1.site1.com -d subdomain2.site1.com// --pre-hook "systemctl stop apache2" --post-hook "systemctl start apache2" 
 + 
 +You must “Expand” the subdomains for as many as you have 1, 2, 3 … etc., and that's what the additional ``d`` flags do. After this, navigate back to WP and set-up both sites using the new “My Sites” panel at the top.  
  
-You must “Expand” the subdomains for as many as you have 1, 2, 3 … etc. After this, I navigated back to WP and set-up both sites using the new “My Sites” panel at the top (yes, I had done them multiple times before but failed). Once I went in exactly this order/fashion, everything worked and, in fact, I write this educational blog to you now using one of those new multi-sites. In fact, if everything goes okay, since I used an identical virtual host name as my previous non-multi-site virtual host, this post should simply syndicate to #LiDA103 flawlesslyHope it does and, if it does not, more haacking to come!+ --- //[[jonathan@haacksnetworking.com|oemb1905]] 2019/12/30 02:16//
computing/wpmultisite.1565286044.txt.gz · Last modified: 2019/08/08 17:40 by oemb1905