In 2010, WordPress released version 3.0 of it popular content management platform. Among the many improvements included in the release, the WordPress community combined WordPress MU into the main WordPress configuration. Since the change, WordPress has made it easier to create multiple WordPress sites on one server. Whereas earlier, each WordPress blog on a server needed to have its own installation, now a new WordPress site can be installed once, and other blogs can be set up from within the WordPress dashboard.
The steps in this tutorial require the user to have root privileges. You can see how to set that up in the Initial Server Setup
Before working with WordPress, you need to have LAMP installed on your virtual private server. If you don't have the Linux, Apache, MySQL, PHP stack on your VPS, you can find the tutorial for setting it up in the Ubuntu LAMP tutorial.
Once you have the user and required software, go ahead and Install WordPress. However—make sure you stop at the end of step 4 (We will add one more thing to the Wordpress config file in the next step)
With WordPress installed, we need to take a series of steps in a variety of configuration files.
To begin with, modify the WordPress configuration, activating the multisite networking:
sudo nano /var/www/wp-config.php
Add the following line above "/* That’s all, stop editing! Happy blogging. */"
/* Multisite */ define('WP_ALLOW_MULTISITE', true);
After that save the file and exit. You can do so by pressing CTRL+O to save and then followed by CTRL+X to exit.
Activate the apache Mod_Rewrite module:
sudo a2enmod rewrite
Follow up by permitting .htaccess changes in the virtual file. Open up your virtual host file (I am simply going to make these changes in the default Apache one).
sudo nano /etc/apache2/sites-enabled/000-default
In the following section, change AllowOverride to All:
<Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>
Restart apache:
sudo service apache2 restart
Once that is all done, the WordPress online installation page is up and waiting for you:
Access the page by adding /wp-admin/install.php to your site's domain or IP address (eg. example.com/wp-admin/install.php) and fill out the short online form.
Go into your WordPress dashboard and select the section called tools:
Once you have filled out the required fields, go through the directions on the next page (I have elaborated on them further under the image):
sudo mkdir /var/www/wp-content/blogs.dir
sudo nano /var/www/wp-config.php
define('MULTISITE', true); define('SUBDOMAIN_INSTALL', false); $base = '/'; define('DOMAIN_CURRENT_SITE', 'YOUR IP ADDRESS HERE'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1);
sudo nano /var/www/.htaccess
RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L]
uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).) $1 [L] RewriteRule ^[_0-9a-zA-Z-]+/(..php)$ $1 [L] RewriteRule . index.php [L]
After making all of the necessary changes, log into WordPress once more.
After you log into your site once again, you will notice that the header bar now has a section called, “My Sites” instead of simply displaying your blog’s name:
You can create new sites by going to My Sites at the top, clicking on Network Admin, and clicking on Sites:
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
Former Director of Community at DigitalOcean. Expert in cloud topics including LAMP Stack, CentOS, Ubuntu, MySQL, SSL certificates, and more.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
nginx users should take a look at this: http://codex.wordpress.org/Nginx#WordPress_Multisite_Subdirectory_rules
I came across this article. I’ve not tried the tutorial, but I look forward to another Digital Ocean tutorial on this topic.
As of 6/24/13 the images in the post do not show the Subdomain option of multisite. If you use the subdomain option it does change the rest of the instructions slightly since you don’t need to create a blogs.dir folder.
I just learned that the change I referred to previously in regard to blogs.dir is due to a change in how Wordpress handles multisite uploaded_file_path after version WP 3.5.
http://codex.wordpress.org/Multisite_Network_Administration#Uploaded_File_Path
This article should probably be updated to reflect the change.
<p>As @andrew pointed out…</p> <p> The .htaccess rules referenced above should only be used with WP Multisite installs that started out with WordPress 3.0 through 3.4.2. For WordPress 3.5+ installs, use the rules below; but, ONLY use the rules below if you STARTED Multisite on 3.5. If you upgraded from 3.4 to 3.5, use the old ones referenced above! </p> <pre>RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^ - [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(..php)$ $2 [L] RewriteRule . index.php [L]</pre>
What if I already installed wordpress (and passed step 4) via this guide: https://www.digitalocean.com/community/articles/how-to-install-wordpress-on-ubuntu-12-04
Can I still set up multisite without deleting wordpress and starting over and if so how?
Ok, I went ahead with the steps to configure multisite and it appears to have mostly worked, though I’m now running into this issue: I’ve finished wordpress setup and I have the “My Sites” menu available but when I select “Network Admin” I get a “website unavailable” page; It appears that it’s trying to pull up the address: “youripaddresshere/wp-admin/network”. How do I set that address to my droplets IP or hostname?
Sorry to leave another comment but it won’t let me amend my previous one… So I tried pointing my browser directly at myip/wp-admin/network with no luck either— seems like it’s still trying to route to “youripaddresshere/wp-admin/network” even though I’ve put replaced with my IP address and still saying website unavailable.
Fixed my problem! I hadn’t replaced the “youridaddresshere” text in wp-config.php. Doh!
After trying to troubleshoot this myself and coming up with no solutions, I thought I would post the problem here. I am trying to set up multisite from a fresh install of LAMP and Wordpress. It seems like the install goes just fine until I either create a site or even a regular page. For the new site I receive a 404 error when I try to visit the dashboard. It is pointing me to - “http://myipaddress/thenewsite/wp-admin/”. The same thing goes for creating a new page for the base site. I go to visit the page at “http://myipaddress/new-page-here/” and receive a 404 error.
I have a feeling that it is an issue with mod_rewrite or pretty permalinks, but I have enabled both and updated my .htaccess file. Any thoughts?
@ekkletec: Assuming you’re on Wordpress 3.5, please see Pablo’s comment above.
Kamal - Thank you for your response. Unfortunately, I already used those rules in my .htaccess file. I don’t know if it helps, but I am trying to install on Ubuntu 12.04. Also, here are the rules in my .htaccess file:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
RewriteRule . index.php [L]
Let me know if there is further information I can provide that might help troubleshooting. Thanks!
It looks like I edited the wrong line in the virtual host file, so it wasn’t allowing apache to change the .htaccess file. Thank you so much for your help. Everything seems to be working now!
I’ve got everything setup right and chose subdomain. Everything works until I try to to go the subdomain site itself where I get a server not found error.
I did add the virtualmin/webmin panel to my install and then used that to add the * wildcard dns A option. I even checked the config file for the site to make sure I had the * wildcard Alias in there.
Of course I have also rebooted apache.
This is the first time I have ever had this issue, so not quite sure where to go from here. Ideas?
@gaffneyiphone: I believe you can’t have a wildcard A record, what’s the domain name and what subdomain are you trying to access? It looks like it’s a DNS error.
Sorry if I’m being dumb, but using the pre installed Wordpress droplet, the first attempted edit of wp-config.php is not in /var/www. Where is it?
It’s at /home/wordpress/public_html/wp_config.html. However, the Apache setup now doesn’t include any directory pointers - only to a specific document root. So, are these instructions past their sell by date for the currently distributed Wordpress pre configured droplet? Not sure where to go next…
I followed the guide, but after finish the 2nd step section “My Sites” is missing. I can’t go ahead with the guide. Help please!!!
@Ian.waring: Replace all occurrences of /var/www/ in this article with /home/wordpress/public_html and /etc/apache2/sites-enabled/default with /etc/apache2/sites-enabled/yourdomainname.com
Let me know if that works.
Hi Kamal,
The file named after my domain name contains only two Virtualhost definitions for port 80. It has no Directory entries for /var/www on board at all to add the override to.
In theory, I should be adding a document root in there, not sure whether directory is something I need to add also.
Hi Kamal,
Thank you for your response. I used firefox to install WordPress multisite. I cleared firefox’s cache… no fix it. I tested to access using others browser on my PC and “My Sites” still missing. I tested to access using another PC and the same thing. I checked the database, network tables were created. I enabled WordPress’s debug (define(‘WP_DEBUG’, true);) and get message “Constant MULTISITE already defined in /usr/share/sites/blog/wp-config.php on line 94”
@mmerino: The constant is already defined – you have the define() line twice in wp-config.php
Delete one of them.
The instructions tell me to edit /etc/apache2/sites-enabled/yourdomainname.com
In my case, that file corresponding to my domain name contains (between the ++ and – here):
++ <VirtualHost *:80> ServerAdmin webmaster@yourdomainname.com DocumentRoot /home/wordpress/public_html Servername yourdomainname.com ServerAlias www.yourdomainname.com </VirtualHost>
So, where do I put the text you highlighted, vis:
<Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory>
? I guess everyone using the same Wordpress 12.10 droplet will have the same issue on a fresh install…
Hi Kamal,
Again thanks for you reply!!! You give me an importante clue to find my huge mistake. The lines to configure multisite on wp-config.php were BELOW the line /* That’s all, stop editing! Happy blogging. */. I’m not english speaking and I ignored the word ABOVE in the guide. Thanks for your time!!! and sorry.
Hello everyone, i have been trying since a while to retrieve the subdomain posts to main domain homepage. Can anyone please help me in giving a step step by procedure to do the same.
If incase you require more info from my side, please let me know. 123nagar.com@gmail.com is my id. Thanks for your valuable time.
sub-domain is possible, here are some tips:
• create droplet > one-click digital ocean WP install • create wildcard record by —> digital ocean dashboard > dns > view > add record > select “a” record > host = asterix symbol > enter ip > click create. • ignore direction above to “make directory” (not needed) • update your wp-config file, .htacess file plus default file AFTER you log into WP for the first time. • change the default WP URL BEFORE you configure network (dashboard > settings > etc…etc…)
p.s. I wish the comment system has “preview” or “edit” - pitiful to see how powerful Digital Ocean is, yet so backwards in community comment technology.
Fixed it. The Wordpress install in this droplet uses subfolders, but these go into the database, not into the file system, so the Directory additions to the Apache config file weren’t needed. I also put quotes around the word false when editing one of the wp-config lines, which confused it further.
The only gotcha I’m having is that the default site, and indeed any network site I’m about to create, all reference my IP address rather than the true domain name. Looks like the database has been set up that way, and I’m not sure how to get it back to using my domain name. If I change the site domain name in the wp-config file, then any access attempt from a browser just spits out a Database query error :-(
Any ideas on how I engineer that change?
Dollar base = ‘/’ in wp-config.php also appears to have broken things. The Wordpress install didn’t mention that line, and mine started working when it was omitted.
Kill my query. I deleted the droplet and started over, and got it completely working this second time around. Just extra careful to follow the directions from the Wordpress install to the letter, and to be consistent with my domain name throughout the install process. Now working like a dream :-)
Why not install two different Wordpress installations? I followed the guide here https://www.digitalocean.com/community/articles/how-to-set-up-multiple-wordpress-sites-on-a-single-ubuntu-vps and had no problems with it. Are there any performance considerations with this method?
@bora.aymete: You should choose which method that fits your needs. It’s generally recommended to use multiple wordpress installations unless you need to use mutlisite.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.