Skip to main content
null 💻 notes

NGINX + WPMU + Non-WordPress Subdomains

I've been trying to configure a subdomain on a WPMU install that runs on Nginx that is not part of the WPMU network and have ran into nothing but problems. In this post, I discuss some of the problems I ran into while trying to setup non-WordPress sub-domains alongside a WPMU sub-domain site and how I got both WP and non-WP sub-domains working and correctly configured in Nginx (hint: I didn't).

Here's my setup:

WPMU is running on Nginx in root /var/www/wordpress.

I have subdomains to domain.com that are all domain-mapped (using the WPMU Domain Mapping plugin) and correspond to top-level domains of the same name. For example, lawsonry.com is domain-mapped to lawsonry. domain.com. Everything is working fine for all my WordPress sites, but that is both good news and bad news.

The part of it that's bad is that only WordPress is working correctly. I'm trying to setup a new, non-WordPress subdomain at forums.domain.com, but every time I modify .conf files or think I've found the solution, the forum sub-domain continues to not work. I'm using Firefox, and my browser keeps telling me that the server could not be found.

I tackled this problem by having a look at Kristian Freeman's example, which is, quite frankly, one of the more pragmatic examples of an Nginx configuration I've seen in a while. After trying to integrate it into all the tutorials I was reading that involved getting WP setup on Nginx with php-fpm and it never working, I started to get frustrated. I was using a vhost filesystem (like you're supposed to do), so I had symbolic links setup from /etc/nginx/sites-available/\* to /etc/nginx/sites-enabled/\*. There weren't that may config files; I was actually very impressed by how light the conf setup is compared to what I was doing with Apache2.

How did Freeman's example help? It reminded me no stop looking so deep into my issues. What I mean by that is this: if you know your Nginx files are written correctly, leave them alone. My problem was that I kept attributing the "server not found" errors when trying to access my non-WP subdomain to Nginx, when in fact they were due to WPMU's configuration files for Nginx.

You Cannot Have non-WordPress Subdomains if your WordPress Multisite is setup for Subdomains. #

This was the result of about 18 hours of straight frustration. As it turns out, just disabling the multisite feature of my main WP install allowed me to access my sub-domains. Weird, right?

/etc/nginx/nginx.conf
/etc/nginx/conf.d/wordpress-mu.conf
/etc/nginx/sites-available/domain.com
/etc/nginx/sites-available/sub.domain.com

and with that structure, only top-level domains were working.

Of course, WPMU tells you that this is the case but my stubborn self didn't want to believe it. Well, believe it.

Has anyone had a chance to work on a workaround?