This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
computing:wpmultisite [2019/08/08 17:40] – created oemb1905 | computing:wpmultisite [2019/12/30 02:18] (current) – oemb1905 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ------------------------------------------- | ||
+ | * **wpmultisite** | ||
+ | * **Jonathan Haack** | ||
+ | * **Haack' | ||
+ | * **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, | + | ------------------------------------------- |
- | 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, | + | A tutorial |
- | 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/ | + | ------------------------------------------- |
- | I have already been challenged by the program in its questions, formally 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 a hole in my intermediate | + | First, set up a self-hosted |
- | 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 / | + | |
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 */ | + | |
- | define(' | + | define(' |
Once that is done, go to your site1.com/ | Once that is done, go to your site1.com/ | ||
- | sudo nano / | + | |
- | Add the following just below the line you added above: | + | Add the following just below the line you added above: |
- | define(' | + | |
- | define(' | + | define(' |
- | define(' | + | define(' |
- | define(' | + | define(' |
- | define(' | + | define(' |
- | define(' | + | define(' |
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 / | + | |
- | 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] | + | |
- | 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 / | + | |
- | sudo cp / | + | sudo cp / |
- | sudo nano / | + | sudo nano / |
- | sudo cp / | + | sudo cp / |
- | sudo nano / | + | sudo nano / |
- | 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 " | + | |
+ | |||
+ | 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/ | + | --- // |