How to Install WordPress multisite

Step#1

First you need to finish installing WordPress.  Please refer to “How to install WordPress” to get started.

Step#2

You need to add following line just above the line /* That’s all, stop editing! Happy blogging. */ inside wp-config.php file.

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

Now save wp-config file and login as admin to your WordPress site. Go to tools>Network Setup. This option is not available by default, its visible after you have made above changes in wp-config.php file

You will see following scree:

Now select your multisite option with subdirectory or subfolder as per your requirement. Whether to choose subdirectory or subfolder, its completely dependent on your requirement.

It will take few second to install multisite, once done following screen will appear.

Now add following settings just above the line reading /* That’s all, stop editing! Happy blogging. */ Below code is for subdomain, if you have selected subdirectory, it will be slightly different. Please use whichever code is displayed in your admin section.


define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'localgoingplaces.me');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

Step#3

You can manually add each site, however when there are multile sites, this ecomes tedious process. This can be automated by using a plugin called nginx helper. Install plugin called as nginx-helper from install plugin section.

nginx-helper settings

You don’t have to network activate this plugin. Simply to go your base site plugin section and activate this simillar to other plugins.

Now to to Network Admin–>Settings–>Nginx Helper”. This option will be available only after you have activated the plugin (No Network activation is needed)

Please select enable nginx map and enable nginx logging

Update file nginx file

You would have already created nginx file while installing WordPress as per “How to install WordPress” post.  Now add following code at the start of nginx file.

Don’t copy below code as is. Use the line displayed in previous step in nginx-helper settings page


map $http_host $blogid {
default 0;
include /var/www/wordpressmultisite1/wp-content/uploads/nginx-helper/map.conf;
}

Also if you are planning to use subfolder option, please add following code just before closure of sever block


if (!-e $request_filename) {
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;
    rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
    rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}

Now your multi-site is ready for the use

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.