Difference between revisions of "WordPress Multisites"

From Anarchaserver
(Created page with "= How to use Wordpress (multi-site) = ! There is users (and administrators) for the network administration of the farm and there is users (and admin) per blog wp ! '''If a us...")
 
Line 19: Line 19:
Create the vhost proxy in the apache2 of the hosts to redirect the traffic to the container in sites-available/
Create the vhost proxy in the apache2 of the hosts to redirect the traffic to the container in sites-available/
  nano /etc/apache2/sites-available/zoiahorn.conf
  nano /etc/apache2/sites-available/zoiahorn.conf
<syntaxhighlight lang=php>
<syntaxhighlight lang="PHP">
<VirtualHost *:80>
<VirtualHost *:80>
         ServerAdmin webmaster@localhost
         ServerAdmin webmaster@localhost
Line 47: Line 47:


  nano /etc/apache2/sites-available/zoiahorn-le-ssl.conf
  nano /etc/apache2/sites-available/zoiahorn-le-ssl.conf
<syntaxhighlight lang=php>
<syntaxhighlight lang="PHP">
<IfModule mod_ssl.c>
<IfModule mod_ssl.c>
<VirtualHost *:443>
<VirtualHost *:443>
Line 94: Line 94:
Create a virtual host in apache2 container :
Create a virtual host in apache2 container :
  nano /etc/apache2/sites-available/zoiahorn.conf  
  nano /etc/apache2/sites-available/zoiahorn.conf  
<syntaxhighlight lang=php>
<syntaxhighlight lang="PHP">
<VirtualHost *:80>
<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   ServerAdmin webmaster@localhost
Line 108: Line 108:


  nano /etc/apache2/sites-available/zoiahorn-le-ssl.conf
  nano /etc/apache2/sites-available/zoiahorn-le-ssl.conf
<syntaxhighlight lang=php>
<syntaxhighlight lang="PHP">
<IfModule mod_ssl.c>
<IfModule mod_ssl.c>
<VirtualHost *:443>
<VirtualHost *:443>
Line 193: Line 193:
'''After that you will need to re-login to your WordPress site to access the multisite network.'''
'''After that you will need to re-login to your WordPress site to access the multisite network.'''


[[File:Wp-multi.png]]
[[File:Wp-multi.png|700px]]


* https://www.wpbeginner.com/wp-tutorials/how-to-install-and-setup-wordpress-multisite-network
* https://www.wpbeginner.com/wp-tutorials/how-to-install-and-setup-wordpress-multisite-network
= Troubleshooting =
== Permalinks ==
Not possible to change the way Wordpress produce the permalinks: for each site https://zoiahorn.anarchaserver.org/wp-admin/options-permalink.php
Only "Plain" system work, else the articles give a 404 when linked, may come from .htaccess or FollowSymlink in apache ?

Revision as of 21:48, 6 May 2019

How to use Wordpress (multi-site)

! There is users (and administrators) for the network administration of the farm and there is users (and admin) per blog wp !

If a user is created on the network level, than she/he has to be added as a user of a particular blog to be able to write in it

For now, a new template or plug-in should be added by hand (threw ssh access on the server, see below)

Configuration an tuning

Configure the upload limit for all the blogs in https://zoiahorn.anarchaserver.org/wp-admin/network/settings.php

Max upload file size 1000000 k 

Disable comments on new blog if not needed

Classic editor has been set up by default on all blogs (bug in the new one)

WordPress Multisites installation in a LXC container

vhost on the host

Create the vhost proxy in the apache2 of the hosts to redirect the traffic to the container in sites-available/

nano /etc/apache2/sites-available/zoiahorn.conf
<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName zoiahorn.anarchaserver.org


        ErrorLog ${APACHE_LOG_DIR}/zoiahorn-error.log
        CustomLog ${APACHE_LOG_DIR}/zoiahorn-access.log combined


  ProxyPreserveHost       On
  ProxyRequests           Off

   ProxyPass / http://10.0.3.5/
   ProxyPassReverse http://10.0.3.5/ /

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

RewriteEngine on
RewriteCond %{SERVER_NAME} =zoiahorn.anarchaserver.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
</VirtualHost>
nano /etc/apache2/sites-available/zoiahorn-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerAdmin webmaster@localhost
        ServerName zoiahorn.anarchaserver.org


        ErrorLog ${APACHE_LOG_DIR}/zoiahorn-error.log
        CustomLog ${APACHE_LOG_DIR}/zoiahorn-access.log combined


  ProxyPreserveHost       On
  ProxyRequests           Off

   ProxyPass / https://zoiahorn.anarchaserver.org/
   ProxyPassReverse / https://zoiahorn.anarchaserver.org/

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>
SSLEngine on
SSLProxyEngine On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off

#RewriteEngine on
SSLCertificateFile /etc/letsencrypt/live/zoiahorn.anarchaserver.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/zoiahorn.anarchaserver.org/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
</IfModule>

Activate the virtual hosts :

a2ensite zoiahorn.conf
a2ensite zoiahorn-le-ssl.conf
sytemctl reload apache2

vhost in the container

Connect to the container as root

lxc-attach -n livingdata

Create a virtual host in apache2 container :

nano /etc/apache2/sites-available/zoiahorn.conf 
<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   ServerName zoiahorn.anarchaserver.org

	DocumentRoot /var/www/zoiahorn/


   ErrorLog ${APACHE_LOG_DIR}/zoiahorn-error.log
   CustomLog ${APACHE_LOG_DIR}/zoiahorn-access.log combined
</VirtualHost>
nano /etc/apache2/sites-available/zoiahorn-le-ssl.conf
<IfModule mod_ssl.c>
<VirtualHost *:443>
   ServerAdmin webmaster@localhost
   ServerName zoiahorn.anarchaserver.org

	DocumentRoot /var/www/zoiahorn/

	ErrorLog ${APACHE_LOG_DIR}/zoiahorn-error.log
	CustomLog ${APACHE_LOG_DIR}/zoiahorn-access.log combined

       <Directory />
                Options FollowSymLinks
                AllowOverride all
       </Directory>

       <Proxy *>
               Order deny,allow
               Allow from all
       </Proxy>

SSLEngine on
SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

#RewriteEngine on
# Some rewrite rules in this file were disabled on your HTTPS site,
# because they have the potential to create redirection loops.
# RewriteCond %{SERVER_NAME} =zoiahorn.anarchaserver.org
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]
#Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
</IfModule>

Wordpress normal installation

Install a normal wordpress in /var/www/zoiahorn

cd /var/www
wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz 
mv wordpress/ zoiahorn/
cd zoiahorn/

Create the Database as adviced here https://codex.wordpress.org/Installing_WordPress#Using_the_MySQL_Client

mysql -u root -p

Go to https://zoiahorn.anarchaserver.org to finish the configuration, at the end of the config, a web page propose to copy paste the content of wp-config.php :

nano wp-config.php
touch .htaccess
chown www-data: .htaccess 

Install old editor as the new one is buggy

cd wp-content/plugins/
wget https://downloads.wordpress.org/plugin/classic-editor.1.4.zip
unzip classic-editor.1.4.zip 
rm classic-editor.1.4.zip

Prepare upload directory

cd ../../wp-content/
mkdir uploads
chown www-data: uploads/

Add some themes

cd wp-content/themes/
wget https://downloads.wordpress.org/theme/pixova-lite.2.0.4.zip
unzip pixova-lite.2.0.4.zip 
wget https://downloads.wordpress.org/theme/dulcet.0.0.7.zip
unzip dulcet.0.0.7.zip 
rm *.zip

Optimise database

mysqlcheck -u anarchawpdbuser -p newzoiahorn --optimize

Wordpress multisite installation

Activate Network feature

nano wp-config.php

Add the line :

/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );

Desactivate WP Plug-ins

You can now head over to Tools » Network Setup page to configure your multisite network. Networksetup.png Choose the domain structure and click install, WordPress will now show you some code that you need to add to your wp-config.php and .htaccess file respectively.

nano wp-config.php
nano .htaccess

Networksetup2.png

After that you will need to re-login to your WordPress site to access the multisite network.

Wp-multi.png

Troubleshooting

Permalinks

Not possible to change the way Wordpress produce the permalinks: for each site https://zoiahorn.anarchaserver.org/wp-admin/options-permalink.php

Only "Plain" system work, else the articles give a 404 when linked, may come from .htaccess or FollowSymlink in apache ?