WordPress-Multisite + Domain-Mapping

EDIT: I am not sure why this isn’t anywhere on the site but I found this github issue discussing a different command for installing Wordpress Multi-site if you are planning to use domain mapping. Below is the example code:

ee site create example.com --dm

--dm flag will make example.com as default_server and install + config domain-mapping plugin

It will imply --wpsubdom.

For wp-subdir and domain-mapping

ee site create example.com --dm --wpsubdir

I must be doing something wrong but I followed all the steps I could find on setting up Wordpress in Multisite mode using subdomains and setting up domain-mapping.

I ran the below code to setup the server and setup the base Wordpress install:

wget -qO ee rt.cx/ee && sudo bash ee
ee site create teamcfi.com --wpsubdom --wpfc

After which I installed the WordPress MU Domain Mapping plugin. I updated the wp-config.php file with:

define( 'SUNRISE', 'on' );

and I copied over the sunrise.php file. Then I updated the IP address in the domain mapping settings and it gave me a message stating it created the mapping table.

I added a domain beyondanetbranch.com with the site ID of 3 for my http://test.teamcfi.com/ test site.

I updated the DNS records to point to the correct domain but it always just goes to the default Nginx page. I assumed the easyengine setup script would setup the Multisite install correctly so I guess I am doing something wrong.

On a previous test site I went into the default Nginx config file and commented out:

listen 80 default_server;

and enabled it on the config file for my main site, at which point the domain mapping sorta worked.

Depending on how I mapped the domain, either www.beyondanetbranch.com or beyondanetbranch.com it would only work for one or the other and would redirect to the main site if the opposite was navigated too. Ex: If I set it up for beyondanetbranch.com and tried to navigate to www.beyondanetbranch.com it would redirect to teamcfi.com.

I know this isn’t a direct question for just one problem but all the above problems seem to be presenting themselves on the 3 test sites I have worked on thus far. I am curious if uncommenting the listening port is required and if so why wasn’t it listed in the instructions or if not can someone advice on the steps I am missing and how do I deal with the routing issues with the routing issue when attempting to visit the site with www at the start of the domain address?

I don’t know if this is the “right” way to fix it, but I did this:

  1. remove “default” configuration from /etc/nginx/sites-enabled
  2. in /etc/nginx/sites-enabled config there are two lines you need to uncomment

Then, the pièce de résistance is to add your mapped domain to the beginning of the server_name line.

In my case the nginx/sites-enabled config looks like this:

`server {

# Uncomment the following line for domain mapping
listen 80 default_server;

server_name www.richpav.xyz happysmileyenglish.com  *.happysmileyenglish.com;

# Uncomment the following line for domain mapping
server_name_in_redirect off;

`

Hope that helps. I’m only on my second day with easyengine.

Okay, I actually did something like that. I came across an article saying to run the below code to change the name of the default config file so it would activate last, which seems to have solved the first issue.

The second issue still eludes me. Registering a domain in the mapping tool doesn’t seem to provide a redirect for other sub-domains of the same domain. e.g. If I register example.com that will work find but navigating to www.example.com navigates back to the base domain.

I deleted the link to default in sites-enabled and that solved my problem. The multisite domain is the default now, and it seems you can’t have two servers claiming to be the default or nginx throws an error.