You are here
WordPress multisite support (aka. Network Sites)
A multisite network is a collection of sites that all share the same WordPress installation. They can also share plugins and themes. The individual sites in the network are virtual sites in the sense that they do not have their own directories on your server, although they do have separate directories for media uploads within the shared installation, and they do have separate tables in the database.
The following steps are required in order to enabled multisite support in TurnKey WordPress:
1. Decide whether you want to use sub-domains or sub-directories
Wordpress multisites can either be served from a sub-domain or a sub-directory, for example:
- Sub-domains: site1.example.com, site2.example.com
- Sub-directories: www.example.com/site1, www.example.com/site2
Important: If you decide sub-domains, then SITE would be http://example.com . If you decide sub-directories, then SITE would be http://www.example.com .
Note: Sub-domains require you to be able to update your domains DNS records (see TurnKey Domain management).
2. Update the wordpress configuration
Edit /var/www/wordpress/wp-config.php
Delete the following: define('WP_SITEURL', 'http://'.\$_SERVER['HTTP_HOST']); define('WP_HOME', 'http://'.\$_SERVER['HTTP_HOST']); And in its place, add (replace SITE with what you decided in step 1): define('WP_SITEURL', 'SITE'); define('WP_HOME', 'SITE'); define('WP_ALLOW_MULTISITE', true);
Update the database
mysql --defaults-extra-file=/etc/mysql/debian.cnf <<EOF USE wordpress; UPDATE wp_options SET option_value='SITE' WHERE option_name='home'; UPDATE wp_options SET option_value='SITE' WHERE option_name='siteurl'; EOF
Comments
What value for 'SITE' for local WordPress multisite development?
I would like to do WordPress multisite development on my local instance, but it is not clear to me from the steps above as to what value I should set 'SITE' to be to do this.
My Wordpress Turnkey appliance runs on my PC and gets its IP via DHCP and it is currently 192.168.1.8.
Can I just use the IP or is some sort of domain name required to enable Wordproess multisite? Can I simply enter the 'SITE' value as the current IP 192.168.1.8 in /var/www/wordpress/wp-config.php like so?:
And run the SQL as so?:
The IP for my Wordpress Turnkey appliance is obtained via DHCP, will a different IP be picked up OK or will I need to edit wp-config.php and re-run the SQL every time?
'https' or 'http' as 'SITE' value
Hi,
I just have a fresh install and requested a Let's Encrypt certificate for different subdomains, which works. One of the next steps is that I want to disable http and enable https only. My question is before I move to https only access in which order should I perform above procedure regarding multisite:
1) Disable http access first and execute above procedure with 'https://' SITE prefix as parameter.
2) Execute above procedure with 'http://' SITE prefix as parameter and then disable http access.
Macamba