WordPress MU Domain Mapping 0.5

WordPress MU Domain Mapping is a plugin that allows the users of a WordPress MU site to use custom domains on their blogs.

It’s been a while since the last release but with the help of Ron Rennick, and many others (kgraeme – you kick ass at finding bugs!) I think the wait has been worth it. Changes since the last release:

  1. Works in VHOST or folder based installs now.
  2. Remote login added.
  3. Admin backend redirects to mapped domain by default but can redirect to original blog url.
  4. Domain redirect can be 301 or 302.
  5. List multiple mapped domains on site admin blogs page if mapped
  6. Bug fixes: set blogid of the current site’s main blog in $currentsite
  7. Bug fixes: cache domain maps correctly, blogid, not blog_id in $wpdb.
  8. and lots more bugs fixed and squashed.

There are still a few limitations however:

  1. Your WordPress MU site should be installed in the root of your server.
  2. It’s not possible to map a path on the new domain.
  3. You cannot map a domain on to the main blog in a folder install of WordPress MU.

Grab it from the page above, make sure you read the readme.txt as the plugin needs to be installed and configured correctly. You’ll also need to be familiar with concepts such as CNAME and A DNS records and how to configure your server correctly.

Please try it first on a test server. We have gone to extraordinary lengths to try to fix every bug we could but it’s always better to be careful when trying out new software.

Steal Their Class!

Xbox Live is free for Silver users of the Xbox 360 for the next 5 days in Europe. I just tried Modern Warfare 2 and had my ass handed to me. Didn’t take long for me to see the infamous deathstreak “Steal Their Class!” notice. I was the lowest level player there. Highest was about 67, next lowest was 26. Sigh. Not tempted to buy a Gold membership any more. Thanks Microsoft 🙂


I didn’t disconnect on purpose. WIFI died right after I died for the 5th or 6th time. (If you were on #wordpress you just saw me disconnect, honest!) I swear those guys were probably looking out for the dumb newbie. I’m sure my curiosity will be piqued again in the next few days.

The coop in MW2 is excellent though. I might be willing to part with some cash if some friends were online regularly to play that!

WordPress, Nginx and WP Super Cache

If you host your own WordPress blog, it’s probably on Apache. That all fine and good. For most sites Apache works wonderfully, especially as it’s so easy to find information on it, on mod_rewrite and everything else that everyone else uses.

One of the alternatives is Nginx, a really fast webserver that streaks ahead of Apache in terms of performance, but isn’t quite as easy to use. That’s partly because Apache is the default webserver on most Linux distributions and hosts. Want to try Nginx? Here’s how.

Install Nginx. On Debian based systems that’s as easy as

aptitude install nginx

Nginx doesn’t talk PHP out of the box but one way to do it is via spawn-fcgi. Here’s where it gets complicated. (Docs summarised from here)

  1. Install php5-cgi. Again, on Debian systems, that’s
    aptitude install php5-cgi
  2. Edit /etc/nginx/sites-available/default and add the following chunk of code to the “server” section:
    location ~ \.php$ {
            include /etc/nginx/fastcgi_params;
            fastcgi_index index.php;
            fastcgi_param  SCRIPT_FILENAME  /var/www/nginx-default$fastcgi_script_name;
  3. Install lighttpd for the spawning command.
    apt-get install lighttpd

    You’ll probably get an error at the end of the install if Apache is already running on port 80. Edit /etc/lighttpd/lighttpd.conf and uncomment the line

    server.port = 80

    and change 80 to 81. Now run the apt-get command again and it will install.

    /etc/init.d/lighttpd stop

    will stop lighttpd running. (You don’t need it)

  4. Create a new text file, /usr/bin/php-fastcgi with this:
    /usr/bin/spawn-fcgi -a -p 9000 -u nobody -f /usr/bin/php5-cgi

    The user “nobody” should match the user Apache runs as to make things easier to transition.
    Make it executable with

    chmod 755 /usr/bin/php-fastcgi
  5. Create another new file /etc/init.d/init-fastcgi and make it executable with the chmod command too. Put this in the file:
    case "$1" in
          killall -9 php
          killall -9 php
          echo "Usage: php-fastcgi {start|stop|restart}"
          exit 1
    exit $RETVAL
  6. Start the PHP processes with
    /etc/init.d/init-fastcgi start

    and make sure it starts on every reboot with

    update-rc.d init-fastcgi defaults

That’s the PHP part of things. In Debian, the default root is “/var/www/nginx-default” so put an index.php in there to test things out. Stop Apache and start Nginx (if this is a test server only!) and visit your site. Works? Now to get WordPress and WP Super Cache working.

Open up /etc/nginx/sites-enabled/default in your editor and comment out the text already there with # characters. Paste the following in. Change paths and domains to suit your site. (via)

server {
        server_name  example.com www.example.com;
        listen   80;
        error_log   /www/logs/example.com-error.log;
        access_log  /www/logs/example.com-access.log;

        location ~ \.php$ {
                include /etc/nginx/fastcgi_params;
                fastcgi_index index.php;
                fastcgi_param  SCRIPT_FILENAME  /www/example.com/htdocs$fastcgi_script_name;

        location / {
               gzip  on;
               gzip_http_version 1.0;

               gzip_vary on;

               gzip_comp_level 3;

               gzip_proxied any;

               gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

               gzip_buffers 16 8k;
               root   /www/example.com/htdocs;
               index  index.php index.html index.htm;
# if the requested file exists, return it immediately
               if (-f $request_filename) {

               set $supercache_file '';
               set $supercache_uri $request_uri;

               if ($request_method = POST) {
                       set $supercache_uri '';

# Using pretty permalinks, so bypass the cache for any query string
               if ($query_string) {
                       set $supercache_uri '';

               if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
                       set $supercache_uri '';

# if we haven't bypassed the cache, specify our supercache file
               if ($supercache_uri ~ ^(.+)$) {
                       set $supercache_file /wp-content/cache/supercache/$http_host/$1index.html;

# only rewrite to the supercache file if it actually exists
               if (-f $document_root$supercache_file) {
                       rewrite ^(.*)$ $supercache_file break;

# all other requests go to WordPress
               if (!-e $request_filename) {
                       rewrite . /index.php last;

I think the gzip settings above will compress cached files if necessary but Nginx can use the already gzipped Supercache files. The version of Debian I use doesn’t have gzip support compiled in, but if your system does, take a look at the gzip_static directive. Thanks sivel.

Finally, edit /etc/nginx/nginx.conf and make sure the user in the following line matches the user above:

user www-data;

I changed it to “nobody nogroup”.

Now, stop Apache and start Nginx:

/etc/init.d/apache stop; /etc/init.d/nginx start

WP Super Cache will complain about mod_rewrite missing, and you should disable mobile support.

How has it worked out? I only switched on Friday. The server did do more traffic than normal, but I put that down to the floods in Cork. Weekend traffic was perfectly normal.

Load on the site is slightly higher, probably because my anti-bot mod_rewrite rules aren’t working now. Pingdom stats for the site haven’t changed drastically and I think the Minify plugin stopped working, must debug that this week. Switching web servers is a huge task. I disabled mobile support in Supercache because I need to translate those rules to Nginx ones. A little birdie told me that he’s going to be writing a blog post on this very subject soon. Here’s hoping he’ll put fingers to keys soon.

Have you switched to Nginx? How has your switch worked out for you?

WP Super Cache 0.9.8

WP Super Cache version 0.9.8 is now available. WP Super Cache is a page caching plugin for WordPress that will significantly speed up your website.

New in this release are 2 translations. The Spanish translation is by Omi and the Italian by Gianni Diurno. Please, if you use their translations, drop by their sites and leave a thank you comment! They’ve been very patient with me as I fixed gettext bugs and added new text. Both have blogged about the translations if you need to know more: Gianni, Omi.

The second major feature to go in is an “advanced” section to the debugger. This allows the plugin to check the front page every 5 minutes to make sure everything is ok. It monitors for 2 very rare problems:

  1. Very very occasionally, the front page becomes a gzip file that downloads. It happened here once and I examined the cache file. There was nothing wrong with it. It was perfect. I suspect Apache and mod_rewrite got confused somehow but clearing the cache fixed it. The file generated after was exactly the same size as the old one, so no chance it got “double gzipped”.
  2. In certain rare cases, where a blog has a static front page, and uses a permalink structure of /%category%/%postname%/, the wrong page may be cached as the front page. Even if your blog satisfies the two conditions above it may not suffer from this problem. I tried it on this blog for a few days and couldn’t reproduce it at all!

Nevertheless, if you’re concerned edit your wp-cache-config.php and add this line:

$wp_super_cache_advanced_debug = 1;

Reload the admin page and you’ll see this added to the debug section:


If activated, it will check your front page every 5 minutes. It’s not activated by default because these errors only happen to a small number of blogs. I’ve also noticed that WordPress seems to randomly forget to run the page checker from time to time. I debugged it and the job simply disappears from the wp-cron system! I’ve no idea why, but reloading the admin page schedules it again.
If you’re still paranoid, set your cache expiry low so at least the cache files will be recycled quickly.

Caching, Minification and CDNs

Oh, there’s a new caching plugin on the scene. W3 Total Cache works like Supercache’s half-on mode but can store to memory as well as disk (like Batcache) but also does minification and supports CDNs. I’ve been asked a few times if I’ll support those features too but I don’t see why as other plugins already have that covered (and frankly, I don’t have time to maintain such complex features):

  1. WP Minify “integrates the Minify engine into your WordPress blog. Once enabled, this plugin will combine and compress JS and CSS files to improve page load time.” Thaya is very responsive and fixed a bug I reported quickly.
  2. There are any number of CDN plugins for WordPress. I don’t use a CDN so I can’t recommend one but OSSDL CDN Off Linker might be worth a shot. This post on it mentions Supercache plus, a fork of this plugin.

Traffic Spikes and Benchmarks

I really should collect more of these. A few weeks ago Mark Pilgrim blogged about how his book had been republished by a 3rd party and put up for sale on Amazon. His book was published under the GNU Free Documentation License so that’s perfectly legal to do, even if a little unusual as it can be downloaded from Mark’s website and is for sale by his publisher. The blog post generated a lot of interest and a few days later I received a donation from Mark, followed by a thank you email. I’m a big fan of what Mark does, so if it had been a physical cheque or a letter I’d have framed it!
A few days after that he tweeted the following graph. Nice spike of traffic eh? His server held up fine with help from WP Super Cache.


And finally, some benchmarks, in Russian unfortunately but the pages translates well.


Summary of changes in 0.9.8:

  • Added Spanish translation by Omi.
  • Added Italian translation by Gianni Diurno.
  • Addded advanced debug code to check front page for category problem. Enable by setting $wp_super_cache_advanced_debug to 1 in the config file.
  • Fixed wordpress vs wordpress_logged_in cookie mismatch in cookie checking function.
  • Correctly check if WP_CACHE is set or not. PHP is weird.
  • Added wp_cache_clear_cache() to clear out cache directory.
  • Only show logged in message when debugging enabled.
  • Added troubleshooting point 20. PHP vs Apache user.
  • Fixed problem deleting cache file.
  • Don’t delete cache files when moderated comments are deleted.

PS. WordCamp Ireland is on in early March next year in picturesque Kilkenny. Here’s Sabrina’s launch post. Sign up! I’ll be going!

Retro consoles for sale again!

Retro gaming has made a comeback! A temporary looking shop on North Main Street in Cork is selling old retro consoles at possibly “Irish” prices. According to the “Bargain Hunt” section in Retro Gamer, a Sega Dreamcast can be purchased on Ebay for about £25 Sterling. They’re going for 59.99 Euro here. Cheap enough for an impulse buy? What do you think Mark?

What’s on offer? I saw the Dreamcast of course, many Gameboys in the window, NES, SNES, Sega Mega Drive (Mega CD), Sega Master System, Nintendo Gamecube (why bother when you have a Wii?), Original Playstation, Master System II with Sonic the Hedgehog cart still stuck in it, Xbox 360 external HD DVD player (40 Euro? Can you buy those discs?) and lots of games. I think there were original Xboxes too. There were loads of games for the system anyway.

I doubt the shop will be open after Christmas, none of the consoles or games look brand new so it might be best to test out any purchases when you get home before wrapping them up for Christmas. Bring a copy of Retro Gamer with you if you go in to check the price on Ebay. I have a feeling the guys running the shop will be more than happy to haggle!

Thanks Richard for the heads up. Worth going in there just for the look. I think Branedy may be interested in it too. (I never owned any of the consoles above so I didn’t get a burst of nostalgia for them!)

How to create Postfix database files

Every time I come to recreate the Postfix database file when I edit the file /etc/postfix/virtual.cf I forget what command I need to recreate virtual.cf.db

Hopefully I’ll check my blog next time. The command is postmap. Hope this is useful for someone else too!

postmap /etc/postfix/virtual.cf
/etc/init.d/postfix restart

Happy Modern Warfare 2 Day


November 10th is here and Modern Warfare 2 is finally out! Shops here in Ireland opened at midnight last night and I briefly thought about hopping down to the Gamestop in Blackpool. I didn’t, and I won’t buy it until I have my BarCamp Cork talk is done. That should ensure I have it written by tonight!

Anyway, the level of anticipation for this game reached astronomical levels. Ask anyone with a game console or PC games player and they’ll know about this game. I’m writing this to remind myself of the fact when the next big thing comes along! In five year’s time we’ll be laughing at how we were all swept up in the hype of the game.

So, did you queue last night at midnight to buy the game? Have you already finished it? I’m pretty sure it’ll take me a lot longer to finish than ShadowHearth reported in that thread above.

So its 6:24 and i beated game on veteran setting.

Loved it, in some places i whanted to cry… becouse of just being pwned like a little girl, and on athers places becouse of story…

Just loved it, going to try multiplayer now, untill mine misses wakes up and sees me still on pc… I will get killed.

Hours of fun with Syndicate


  1. Have Macbook. Check.
  2. Have DOSBox. Check.
  3. Have external mouse. Check.
  4. Have Syndicate. Check.

Syndicate is a game I played a lot in the early nineties. I was never any good at games (some things never change!), but this is one of the few games I stuck with and managed to finish. The original game came out in 1993 for DOS and the Amiga. It was on the Amiga that I first came across it but the DOS version is easier to run these days. Luckily both versions are exactly the same.

What do you need? First of all, download the latest version of DOSBox. It’s available for Windows, Linux, Mac OS X and many other operating systems.

Now look for the game itself. You can download Syndicate in many places so search for it using Google. Some would describe it as abandonware as the game can’t be bought any more but it’s a legal grey area. Bullfrog still own the copyright to the game so if you don’t own a copy downloading it is, strictly speaking, an act of piracy.

Unzip Syndicate in a convenient location and launch DOSBox. The familiar DOS prompt will open, on the Z: drive so mount the Syndicate directory using the command of the same name. If you’ve installed it in /games/Syndicate/ use the following:

mount c /games/Syndicate

Now change to drive C using


You may need to edit synd.bat if it’s there (to set up your sound card) or just run main.exe as I did. The game will launch and probably run a little too quickly. Slow it down with CTRL-F11, and use ALT-Enter to enter fullscreen mode. CTRL-F12 will speed it up again, handy for researching new weapons and mods. 🙂

In fullscreen mode, you’ll swear you’re using an Amiga again! Enjoy what must be one of the best shoot ’em ups, ever!

There’s also an opensource version of Syndicate. It hasn’t been updated since 2007 though. Anyone with game coding experience want to lend a hand?

As a special bonus, here’s the Atlantic Accelerator. It’s the very last level in the original Syndicate. This guy makes it appear really easy but it’s not. This level takes quite a bit of time to master! Just read his video description for all that he went through.

Or better yet, check out this video of American Revolt. Wow, all those enemy syndicate guys descend on you like flies to a …

WP Super Cache Developer Documentation

I’ve finally found the time to write up some documentation for developers who want to work with WP Super Cache.

It’s a work in progress but should help other plugin developers who want to interact with the cache.

Suggestions and comments welcome.

PS. If you’re in Cork on November 14th, head along to BarCamp Cork III. I’ll be giving a talk, “How WP Super Cache Works”. It’ll be less technical than this but I’ll answer questions too. Check out the other sessions too.