Update: This article is updated for WordPress 3.5. If you are running old version of WordPress, its highly recommended to upgrade WordPress before creating multisite network.
As we saw in previous article, there are many ways to create a WordPress Multisite Network. Each way can be further optimized using different caching solutions & techniques. But process to create Multisite network itself remains much similar.
To avoid repetition of information across articles, I am posting techniques to create a WordPress Multisite network here itself. If you are familiar with this or already have a Multisite network up, you may jump to Nginx configuration part directly.
In any case, don’t forget to check how to configure server for static content without PHP!
Creating A WordPress Multisite Network
#1. Turn on “Network Setup” option
By default, its disabled in WordPress dashboard.
Open vim /var/www/example.com/htdocs/wp-config.php
Then add following lines to it:
define('WP_ALLOW_MULTISITE', true);
#2. Choose WordPress Multisite Mode
Go to WordPress “Dashboard >> Tools >> Network Setup”.
You will see something like below:
If you can’t find “Network Setup” sub-menu, then you may have probably forget to save changes to wp-config.php file. If this is not a fresh wordpress, wordpress may ask you to deactivate other plugins. Deactivate them and try again.
You will be asked to make a choice between sub-domains and sub-directories setup. I find subdomains easier to deal with.
#3. Update wp-config.php
Open vim /var/www/example.com/htdocs/wp-config.php
Paste codes given by WordPress above line: /* That’s all, stop editing! Happy blogging. */
Below is sample code WordPress-Multisite using sub-directores for example.com
define('MULTISITE', true); define('SUBDOMAIN_INSTALL', false); $base = '/'; define('DOMAIN_CURRENT_SITE', 'example.com'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1);
Below is sample code WordPress-Multisite using sub-domains/domain-mapping for example.com
define('MULTISITE', true); define('SUBDOMAIN_INSTALL', true); $base = '/'; define('DOMAIN_CURRENT_SITE', 'mu.rtcamp.net'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1);
#4. Web-Server (Nginx) Configuration
WordPress will show .htaccess rules for Apache web-server. Since we are on Nginx, these are of no use to us.
You can use any of following Nginx Configuration for your WordPress-Multisite Setup. All following config has extra instructions to activate domain-mapping.
- Nginx + WordPress Multisite (Subdirectories)
- Nginx + WordPress Multisite (Subdirectories) in subdirectory only
- Nginx + WordPress Multisite (Subdirectories) + WP Super Cache
- Nginx + WordPress Multisite (Subdirectories) + W3 Total Cache
- Nginx + WordPress Multisite (Subdomains)
- Nginx + WordPress Multisite (Subdomains) + WP Super Cache
- Nginx + WordPress Multisite (Subdomains) + W3 Total Cache
All above article uses PHP with FPM & APC.
I am also working of fastcgi_cache and hope to publish 3-4 articles about it towards the end of this series. So keep reading! 🙂
While using a multisite option it’s a good idea. I was a bit concerned about some security issues/ that might arise.
I have a linode vps and my configuration right now consists on a couple of wordpress websites with sftp access (a sftp jail in fact), and each “instance” of wordpress is running on a different pool, under a different user. I would love to allow ssh access too, but I haven’t found a tool that helps me to achieve that (anyway that’s another issue, lol).
The drawback it’s clear… I have to manage all of these websites but myself… as you probably already now, users never, ever update the software. So from time to time I have to move into every installation, update it, ecc.
A multisite (with domain-mapping, since are totally different companies) it’s a good idea, since I only have to do the extra-work in the beginning, but I lose the ability to give sftp access and isolate each process.
I’ve been thinking into getting a sort of hybrid approach, and use a multisite for companies that don’t need anything else, and if needed use a “new” installation.
In your experience, do you believe having a multisite would help me more than leaving my configuration as is?
Btw, your tutorials are awesome. Finally I have working wordpress + nginx + apc, I’m so grateful that I’m sure this words aren’t enough to thank you.
Multisite will help only if all sites are similar. For example, wordpress.com. All sites are simple blogs.
If sites are not related (in terms of features/functionality) you will have hard time managing stuff.
We here use hybrid approach. All our blogs/simple-CMS sites are in one MU. This site was earlier in MU but now its a separate one. Earlier this site was a simple CMS. Over time we added bbPress, BuddyPress, woocommerce store, internal-wiki, CRM and few more things to this. At some point things were going out of hand so we had to move this site out of our mail multisite installation.
About SSH – why do you wan’t to give SSH access to everybody?
Hi, I creating WPMU sites with subdomain by following all of the above instructions, everything is working at back end but there is noting on front end of subdomain like http://angrybirds.uptomark.com… error
Oops! Google Chrome could not find angrybirds.uptomark.com please help me.
Have you configured wildcard DNS or atleast A/CNAME records for subdomains?