Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A short description of how I've setup a WordPress Multi-Tenant architecture. This is based on the excellent post by Jason McCreary and the great ascii art explanations by Wes Koop ( & Mark Jaquith (…
I'm using Ubuntu 12.04 and I'm following the Debian/Ubuntu way of dealing with config files. I presume you know how to work with sudo and such
- Install last stable version of WordPress (in my case 3.6) with Subversion into /opt/wordpress/3.6
- create a symlink /opt/wordpress/stable ==> /opt/wordpress/3.6
- create a directory sites in /var/www/sites
- create a directory specific for your site using the domain name e.g. /var/www/sites/
- create a directory wp-content in /var/www/sites/
- create a directory wordpress in /etc
- create a directory named as you site's domain name, e.g. in /etc/wordpress
- copy from /opt/wordpress/stable/wp-config-sample.php to /etc/wordpress/
- fill in the wp-config.php file as you would normally do with the database credentials and such.
- create a symlink from /var/www/sites/ ==> /etc/wordpress/
- create a new wp-config.php in /opt/wordpress/ with the following code:
// set global configurations
define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/wp-content');
define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/wp-content');
// load site-specific configurations
require_once dirname($_SERVER['DOCUMENT_ROOT']) . '/' . $_SERVER['SERVER_NAME'] . '/wp-config.php';
NB: Keep in mind that the protocol is now hardcoded to use http:// it would be better to add something like $_SERVER['HTTPS'] to check if we need https or not.
== Updating ==
1) Download or better check out new version from Subversion, for instance version 3.6.1:
svn co 3.6.1
2) Now you may remove the stable symlink which was pointing to 3.6 and create a new symlink to 3.6.1:
rm stable
ln -s 3.6.1 stable
3) Visit the site, to check if any database updates are needed.
4) Finished!

This comment has been minimized.

Copy link
Owner Author

@BjornW BjornW commented Jan 25, 2014

Do not forget to access the site for the first time with /wp in the url

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.