2

I was searching the Net and also playing around Wordpress to achieve my desired multisite installation, but I wasn't successful yet. What I want to do is to have the network admin site installed on a sub-domain like www.example.com (not example.com) and other sites in the network on sub-domains like client.example.com (not client.www.example.com).

Is there any way to make it possible!?

Important Note: I want to map example.com to a different server with different IP than www.example.com and the rest of sites. Also, I don't want to map each sub site address by hand. I want it to be automatic.

Server specification: I use nginx + php-fpm + fastcgi + centos 5.9.

1
+50

Yes. Here are the instructions:

  1. Install and configure WP for www.example.com
  2. Configure multisite - can use either sub-domain or sub-directory
  3. Install WP Domain Mapping plugin - http://wordpress.org/plugins/wordpress-mu-domain-mapping/
  4. Create new site, e.g. site1
  5. Using Domain Mapping plugin, map site (site1.www.example.com or www.example.com/site1) to preferred sitename (site1.example.com)

I actually have two separate WP sites setup as above, one is sub-domain and another sub-directory. One of the sites is hosting 200 different hostnames. The other is in development and only setup for two hostnames.

  • THanks. Is there any way to make this automatic? I want users to get their correct address immediately, and I don't want to do it by hand. – Ali Hashemi Dec 8 '13 at 20:34
  • 1
    To automate this process you would have to create your own plugin that would do the Domain Mapping plugin setting whenever a new site is created. Not hard, but you need to know how to create plugins. – user42826 Dec 9 '13 at 14:54
1

Currently I work always with Apache, but maybe you should set the constant COOKIE_DOMAIN to a empty value. Otherwise WordPress will always set it to your network’s $current_site->domain and you won’t be able to login into any of the other sites.

define('COOKIE_DOMAIN', '');

the www on the domain is like a subdomain, confused and not helpful. Maybe you set the installation to the domain without www or add a rule to the .htaccess of the installation, that all address will work with the www, like the source below.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

Also a hint to the configuration of nginx for subdomain on WordPress. But I have not tested, only find in this post.

server {
        ##DM - uncomment following line for domain mapping  
        #listen 80 default_server;
    server_name example.com *.example.com ;
    ##DM - uncomment following line for domain mapping
    #server_name_in_redirect off;

    access_log   /var/log/nginx/example.com.access.log;
    error_log    /var/log/nginx/example.com.error.log;

    root /var/www/example.com/htdocs;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args ;
    }

    location ~ \.php$ {
        try_files $uri /index.php;
        include fastcgi_params;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
    }

    location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
        access_log off; log_not_found off; expires max;
    }

    location = /robots.txt { access_log off; log_not_found off; }
    location ~ /\. { deny  all; access_log off; log_not_found off; }
}
  • Well, I have no problem setting multisite network on 'example.com'. I want to install it on 'www.example.com' and point 'example.com' to a different IP. – Ali Hashemi Dec 8 '13 at 21:52
  • Why do you will a difference between with www and without www? Is the same content, only a subdomain and often a problem on a webspace to see a difference with and without www. – bueltge Dec 8 '13 at 22:34
  • I want to hide my site IP address using CloudFlare. The real IP address of example.com can be found using http://www.cloudflare-watch.org/cfs.html but any subdomain is immune. – Ali Hashemi Dec 9 '13 at 6:29
0

You could achieve it changing your nginx configuration. I use Apache, so I'm not able to tell you how to do it. You may find your answer here. If you don't you may better ask on Serverfault

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.