Given a WordPress MU install on Plesk running on Ubuntu with Apache2, we want to configure domain mapping so that
user1 can have myblog1.com mapping to their wordpress blog (myblog1.masterwpmu.com) and
user2 can have myblog2.com mapping to their wordpress blog (myblog2.masterwpmu.com)
We need to configure quite a few moving parts:
- DNS for masterwpmu.com – this should be an A record, pointing to the IP of your server
- DNS for myblog1.com & myblog2.com – these should be CNAME records, pointing to the A record in (1) – eg. masterwpmu.com
- Apache2 – we need to alter the apache vhost conf created by Plesk to setup a wildcard alias
- WordPressMU – we need to configure it to serve the right content when receiving a request for myblog2.com or myblog2.com
When someone makes a browser request for myblog2.com, the following sequence happens:
- myblog2.com is resolved to masterwpmu.com, which is resolved to the IP of your server.
- the browser makes a request to the IP, port 80, passing the host header of myblog2.com
- Apache intercepts the request to point 80, checks through all its known vhost server aliases, and not finding a match redirects to the wildcard alias pointing to our WPMU install
- WPMU gets the request, matches the host header to the correct blog content, and returns the relevant page.
So, how do we configure this?
- Create a new Plesk site, with its own domain name (eg. masterwpmu.com) & install WPMU. Ensure this works.
- Create a new CNAME record myblog2.com which resolves to masterwpmu.com (Its also possible to setup an A record pointing to the same IP as masterwpmu.com; although this will break if the IP of masterwpmu.com ever changes). Google has a nice set of instructions for doing this on most major DNS providers (obviously you’ll want to point to masterwpmu.com rather than ghs.google.com )
- Edit the Apache2 vhost conf created by Plesk at: /var/www/vhosts/masterwpmu.com/conf/httpd.include, changing:
AllowOverride FileInfo Options
- restart Apache2 ( /etc/init.d/apache2 restart)
- Log in to the WPMU install as admin, and create a new blog. Edit the new blog, and change the Domain & FileUpload Url to myblog2.com and http://myblog2.com/files (all the other Urls are automatically updated when you save)
- Browse to http://myblog2.com !
- You can only have 1 wildcard Apache ServerAlias per IP
Hope that helps!