Hi,
I have a question about the nginx multisite mappings in the case of multiple multisite networks hosted on a single nginx instance.
It seems to me that there is a potential for conflict, since AFAIK the Nginx map function cannot be embedded within a server vhost configuration, meaning that the mappings are shared amongst various vhost servers.
Let's say I have two subdirectory- or path-based multisite networks,
each with its own map.conf file that I want to use as follows:
map $blogname $blogid {
default "";
include /srv/web/wpmsnet1/.../nginx-helper/map.conf;
include /srv/web/wpmsnet2/.../nginx-helper/map.conf;
}
Now, consider both multisite networks have a path-based site with the same name (e.g., '/aaa/'), each of which has a different blog id for its respective network. How does the mapping get resolved properly?
As I see it, a brute-force workaround might be to use different names for the $blogid variable in each site's respective vhost configuration files:
map $blogname $wpmsnet1_blogid {
default "";
include /srv/web/wpmsnet1/.../nginx-helper/map.conf;
}
map $blogname $wpmsnet2_blogid {
default "";
include /srv/web/wpmsnet2/.../nginx-helper/map.conf;
}
However, I think a more elegant solution would be to factor the base multisite blog domain or server name into the map, such that it might be used in this way:
map $_server_name$blogname $blogid {
default "";
include /srv/web/wpmsnet1/.../nginx-helper/map.conf;
include /srv/web/wpmsnet2/.../nginx-helper/map.conf;
}
However, this would require that the map.conf files produced by the nginx-helper plugin also include the domain name, as follows:
wpmsnet1.com/aaa/ 2 ;
wpmsnet1.com/bbb/ 3 ;
wpmsnet2.com/bbb/ 2 ;
wpmsnet2.com/aaa/ 3 ;
Likewise, I suppose there would be a problem mapping multisite networks using subdomains or subdomain-mappings onto subdirectory blogs when several networks are hosted on a single nginx instance.
Do you agree that such a problem might exist? Or am I missing something?
If it is a problem, do you suppose the nginx-helper plugin can be extended to construct more disambiguated maps, accordingly (perhaps with an option switch that allows for backwards compatibility)? If so, I'd be happy to assist.
Thanks for your time and consideration.
...Murray