WordPress Multisite with multiple domains using Nginx

I’m growing grey hair here. I’ve tried so many things and yet I can’t get a grasp on how to set this up. Found tons of guides but no one goes through all aspects, which are:

  • A single WP Multisite install that handles several domain based (8 to be exact) sites
  • Site running on Nginx

Following this guide (https://www.digitalocean.com/community/articles/how-to-configure-single-and-multiple-wordpress-site-settings-with-nginx), I’ve set up a server (Ubuntu 10.3) with everything installed and being able to run the WP install through the default sites-enabled config. But as I apply the configs in the tutorial I come to a halt. This is my current setup

Read More

http://pastebin.com/6iSK4H1M

In the tutorial under the example.conf, root is set to point to a directory which I assume will be the same for all sites (“example” dir being the WP install).

If I run the default IP / localhost I can access and login to the WP install. But as I add a domain under sites-enabled (and remove the default config) I just get a notification that the site can’t be displayed.
Have made sure to clear dns caching.

In WP admin, I’ve created a new site and set it as a subdomain with a wildcard (*.example.com), and applied this to wp-config.php –

define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'localhost'); // Does it matter if I put localhost or IP here?
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

And – is a domain mapping plugin really mandatory to get this to work?

Any help would be greatly appreciated!

Related posts

Leave a Reply

2 comments

  1. I don’t have enough reputation for comments and hope I don’t get down voted here.

    I also use Nginx. Although my set up is a little different to yours the principal should be the same.

    In your nginx.conf you need to identify the domain names Nginx will handle. For example;

        http {
    
            include /etc/nginx/sites-enabled/*.conf;
    
            server {
                    listen 0.0.0.0:80; # IP address Nginx will listen on
                    server_name example.com subdomain.example.com;
                   } # End server
    
              } # End http
    

    In my sites-enabled folder I have symbolic links to the configuration files for each domain located in the sites-available folder.

    # example.com.conf
    server {
            server_name example.com;
    
            # Now include your other directives related to example.com
           }
    
    # subdomain.com.conf
    server {
            server_name subdomain.example.com;
    
            # Now include other directives related to subdomain.example.com
           }
    

    My set up is very different to yours. I use Nginx as a caching server for Apache at the back end, but the principals should be the same. Your folder directives related to each of your domains are placed in their respective config files.

    Nginx will serve pages from where ever your config tells it.

    If this is completely wrong then let me know and I’ll remove it. Don’t down vote as I really need the reputation points 🙂

  2. I don’t always outsource my work, but when I do, I hire people in the USA. Have you considered outsourcing this small task on Freelancer? I bet there is a dude out there that’ll solve your problem for $5 – $20.

    I remember, briefly, I messed around WPMU + LEMP Stack and the sunrise file was required. Check out the WPMU Plugins and scout out the documentation. I understand the desire for superior performance but you don’t want to waste away hours and hours of labor.

    Also, another thing, is to consider setting up a WPMU with Softaculous. If your host has cPanel, you should use this script installer.

    enter image description here