How To Setup Wordpress MU in MAMP on Mac OS X

May 16, 2012

Again, as is often quite a common occurence on my blog, i'm again blogging something that I think me and my team will find useful in the future. This time it's setting up a Wordpress MU installation on OS X using MAMP.

We needed a WordPress Multisite install locally so that we could test flexibly, privately, and securely throughout the development process for a new project. It's definitely worth the effort especially if you - like us love developing locally.

Things you'll need

  • Terminal
  • Editor - vim, nano, mate
  • MAMP installed

Getting started

First lets create a site in /Applications/MAMP/htdocs/ - call it mutest

mkdir mutest
cd mutest

Now checkout wordpress with your favourite version control (we use subversion).

svn co .

You'll see it checking out wordpress now - when it's done navigate to localhost:8888/mutest/ and complete the Wordpress installation, i'm going to assume your competent with installing it normally.

Now open up the MAMP portal and perform the following.

Now go to Ports and change the default port from 8888 to 80 - once you do this mamp will restart and probably prompt you for your admin password.

We're going to use the subdomain mapping for wordpress rather than the subfolder so next we need to edit the /etc/hosts file (which is on your mac).

I use textmate with the terminal hook, so I fire up terminal and run a command like so.

mate /etc/hosts

You could run vim or any other terminal editor if you like.

Add two new example domains to the hosts file (you will probably add more in the future but two will do for now).

Save and exit.

Edit your Apache vhosts config file

Open /Applications/MAMP/conf/apache/httpd.conf in a text editor and scroll down to the line that says “#NameVirtualHost *”. Replace that line with the following code:

NameVirtualHost *

 ServerAlias *
 DocumentRoot "/Applications/MAMP/htdocs/mutest"
  Options Indexes FollowSymLinks Includes
  AllowOverride All
  Order allow,deny
  Allow from all

Save and restart mamp server.

Configuring Wordpress MU

Wordpress Multisite is really easy to configure just start by adding the following to your wp-config.php file.

define('WP_ALLOW_MULTISITE', true);

Once you've done this head to wp-admin backpanel and then look for the submenu 'Tools' and click Network.

On this page you will now see an option to use sub-domains for your site addresses. Make sure that’s selected, check the other details, and then click the “Install” button to make it happen. Note that you’ll see a warning message that says, “Wildcard DNS may not be configured correctly!” – we can ignore this warning because we know our DNS is correct.

Finally, complete the steps outlined there on the “Enabling the Network” page (i.e., create a blogs.dir folder and add the required code snippets to your .htaccess etc). After that, re-login to the Admin area and go to Network Admin > Sites > Add New to begin adding your sub-domain network sites.

Your done! It's all over. Your now rocking a nice little wordpress multisite setup locally. Good job. Grab a coffee and get coding!

About me

Hello! I'm David Heward, how are you going? I'm a Senior Devops/Build Engineer, specialising in AWS & Cloud Automation. Based in London. Strong 10+ year background in Software development. Have a read of my blog. Have a look at some of my working projects. Contact me at @davehewy or on Linkedin.