WordPress Multi-Network with Nginx

Today I found out the hard way, how an nginx web-server has to be configured to properly work together with the WP Multi Network plugin.

The problem was, that for some reason and on some machines, WordPress showed always only one blog (not the same on all machines) and ignored the domain entered into the browser. Now it is exactly the purpose of the multi-network plugin to resolve different domains to different blogs (hopefully in a reproducible manner).

It turned out, that the problem was in the nginx configuration that looked like that:

server {
    server_name  _ .fabianmoser.at .nataschastanke.eu;
    #...
}

thus catching both domain names registered for my server.

After some twiddling with the nginx log format to inspect where the http header got lost, I found the following solution:

server {
    server_name  .fabianmoser.at;
    #...
}
server {
    server_name  .nataschastanke.eu;
    #...
}

thus effectively duplicating the virtual server section and giving just one server name each time.

Now everything works fine as you can easily verify yourself.