Multisite setup with Domain Mapping (SSL etc.)


#1

Hello there!

I set up a single WordPress site with Domain: domain.com ( ee site create domain.com --wp --php7 --letsencrypt )

Later in project development we decided to expand this single WP installation to a multisite network.

So I ran ee site update domain.com --wpsubdom

The update went through without issues.

I then set up Domain Mapping without extra plugin installation by editing site-available domain.com-file in nginx by adding another domain to the server name line like so:

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

server_name domain.com  *.domain.com  domain2.com *.domain2.com;

# Uncomment the following line for domain mapping
server_name_in_redirect off;

Then I added another site to my new multisite network under Domain: domain2.com

After that there were two sites in my multisite network: domain.com and domain2.com

Domain.com was working fine also in wp admin. However when triying to login to the wp admin of the domain2.com it wouldnt let me. Also was I not able to access network wp-admin.

So I checked wp-config.php and added the following lines to the newly added lines when ee-updating to multisite in wp-config.php:

done by ee: define( ‘WP_ALLOW_MULTISITE’, true ); define( ‘MULTISITE’, true ); define( ‘SUBDOMAIN_INSTALL’, true ); $base = ‘/’; define( ‘DOMAIN_CURRENT_SITE’, ‘domain.com’ ); define( ‘PATH_CURRENT_SITE’, ‘/’ ); define( ‘SITE_ID_CURRENT_SITE’, 1 ); define( ‘BLOG_ID_CURRENT_SITE’, 1 );/* That’s all, stop editing! Happy blogging. */

my addition: define( ‘NOBLOGREDIRECT’, ‘domain.com’ ); define(‘ADMIN_COOKIE_PATH’, ‘/’); define(‘COOKIEPATH’, ‘’); define(‘SITECOOKIEPATH’, ‘’); define( ‘COOKIE_DOMAIN’, $_SERVER[ ‘HTTP_HOST’ ] );

Now I was able to log into network wp-admin as well as accessing both domain.com and domain2.com wp-admin areas.

However, I once in a while am seeing a cookie issue when trying to switch to network admin from domain.com wp-admin oder domain2.com wp-admin area.

And today I am completely unable to access network wp-admin area. Even after clearing cookies and browser cache.

Something seems to be missing in the nginx configuration. There needs to be some work done on easyengine to handle this better.

Also the script that is handling the letsencrypt SSL certs is not compatible with wp multisite on easyengine. This needs improvement.

I solved the issue by disabling letsencrypt on domain.com and instead adding a multi domain SSL cert issued by PositiveSSL, which covers the planned domains within multisite network.

Back to my initial problem:

Does anyone of you have an idea, why I am seeing random cookie issues? And why it wont let me access network wp-admin all of a sudden?

Best Saskia


#2

Anyone? push

Further thing I investigated: It let’s me view network admin, when I log out, clear cookies, and then directly access /network/wp-admin and login here instead of first logging into a network site wp-admin and after that trying to switch to network wp-admin.

BUT there is still an issue with plugin updates. When I login directly in network wpadmin, and then try to view plugin details or try to update plugins, the details popup appears, however I am being asked to log in again. However this time it won’t let me. nothing happens here. SO I am unable to update plugins - at least via network wp-admin.

Something is wrong here and I can’t seem to figure out what it is.

Please guys, any help is appreciated…


#3

@harshadyeola @Prabuddha

push


#4

Hi Saskia, did you ever resolve this? At one point I had this issue appear out of nowhere on a multisite with a Domain Mapping plugin running, so it might be that a WordPress update caused it. I read somewhere (forgot the bug name/id) there was an issue with the login cookies being addressed…

By now, I’ve passed all my multisites over to run without domain mapping plugin and found that I only needed define('COOKIE_DOMAIN', $_SERVER['HTTP_HOST']); and not those other cookie constants. Only for one multisite that has the famous multi-network plugin running, I needed to do more to make login work all over. But that does not seem to be your case.


#5

Hi Rolf!

Yes I resolved it. But I would have to check what I did back then. It has been a while since I last looked at the configuration, which works flawless for many months now.

Give me a moment


#6