• Resolved bdoreste

    (@bdoreste)


    Is anyone running multiple multisite installations running on a single IP address? I would like to set up several multisite installations, however, I only have one IP address at my disposal.

    The catch – I want to use Donncha’s WordPress MU Domain Mapping plugin to map multiple domains per installation.

    I want to set up groups of installations, so that each group will have its own separate database and admin rights. Each install would have multiple domains mapped to it. If one installation needs to be taken off-line (or breaks), then the other installs will still function.

    any thoughts? is this possible?

    I am using 3.0 RC2; I have the following lines in my wp-config.php:

    define( 'WP_ALLOW_MULTISITE', true );
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', true );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', 'mysite1234example.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    my apache config is here (with wildcard):

    <VirtualHost 192.168.0.0>
            ServerName mysite1234example.com
            ServerAlias www.mysite1234example.com
            ServerAlias *.mysite1234example.com
            DocumentRoot /storage/www/mysite1234example.com
            ServerAdmin webmaster@localhost
            LogLevel warn
            ErrorLog /storage/logs/mysite1234example.com/error_log
            CustomLog /storage/logs/mysite1234example.com/access_log combined
            ServerSignature Off
    
            <Directory />
                    Options FollowSymLinks
                    AllowOverride All
            </Directory>
            <Directory /storage/www/mysite1234example.com>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
            </Directory>
    </VirtualHost>

    and I have Matt’s line in for the wildcard DNS in my zone file here:

    ;wildcard dns and subdomain for wordpress multi site
    ;https://ma.tt/2003/10/wildcard-dns-and-sub-domains/
    *. mysite1234example.com. 14400 IN A 192.168.0.0
Viewing 15 replies - 1 through 15 (of 27 total)
  • Yes, you can run multiple multi-site installs from a single IP. Actually, the IP addresses don’t matter and <VirtualHost *:80> works fine. (Works for me using apache2 on fedora, now using amazon ec2 with ubuntu LTS)

    You can also catch subdomains before they hit wordpress if you have a specific directory that isn’t a wordpress site. Use a separate VirtualHost listing before the wildcard listing.

    <VirtualHost *:80>
    ServerName notwp.mysite1234example.com
    DocumentRoot /storage/www/mysite1234example.com/notwp
    etc . . .

    <VirtualHost *:80>
    ServerName mysite1234example.com
    ServerAlias https://www.mysite1234example.com
    ServerAlias *.mysite1234example.com
    etc . . .

    I should add, continue with additional listings:

    <VirtualHost *:80>
    ServerName example2.com
    ServerAlias https://www.example2.com
    ServerAlias *.example2.com
    DocumentRoot /storage/www/wpinstall2
    etc . . .

    <VirtualHost *:80>
    ServerName example3.com
    ServerAlias https://www.example3.com
    ServerAlias *.example3.com
    DocumentRoot /storage/www/anotherwpinstall
    etc . . .

    Thread Starter bdoreste

    (@bdoreste)

    ok, so ALL non-WP sites on the same IP in your apache config need to be listed in before the WP sites, right?

    how do you point the domains over to the IP in your DNS?

    for example:

    (Install 1 – IP 192.168.0.0)
    mainsite123.com; also hosts the following domains
    – domain123.com
    – domain456.com
    – domain789.com

    (Install 2 – IP 192.168.0.0)
    mainsite456.com; also hosts the following domains
    – domain987.com
    – domain654.com
    – domain321.com

    Obviously, you need to set up a DNS zone file for mainsite123.com and for mainsite456.com to point to IP 192.168.0.0

    How does domain123.com know to point to Install 1, and not Install 2, and vice versa, domain987.com know to point to Install 2 and not Install 1?

    Do you simply set an A-record to point each of the domains under the main domain to the proper IP, or do they each need their own specific zone file?

    Thread Starter bdoreste

    (@bdoreste)

    Okay, I was able to think about this some more… is this a legit Apache config for mixing multiple non-WP and WP installs on a single IP address?

    # non-WP Install
    <VirtualHost 192.168.0.0>
            ServerName foobar123.com
            ServerAlias www.foobar123.com
            ServerAlias *.foobar123.com
    
            DocumentRoot /storage/www/foobar123.com
            ServerAdmin webmaster@localhost
            LogLevel warn
            ErrorLog /storage/logs/foobar123.com/error_log
            CustomLog /storage/logs/foobar123.com/access_log combined
            ServerSignature Off
    
            <Directory />
                    Options FollowSymLinks
                    AllowOverride All
            </Directory>
            <Directory /storage/www/foobar123.com>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
            </Directory>
    </VirtualHost>
    
    # WP Install number 1
    <VirtualHost 192.168.0.0>
            ServerName mainsite123.com
            ServerAlias www.mainsite123.com
            ServerAlias *.mainsite123.com
    
            ServerAlias domain123.com
            ServerAlias www.domain123.com
            ServerAlias *.domain123.com
    
            ServerAlias domain456.com
            ServerAlias www.domain456.com
            ServerAlias *.domain456.com
    
            ServerAlias domain789.com
            ServerAlias www.domain789.com
            ServerAlias *.domain789.com
    
            DocumentRoot /storage/www/mainsite123.com
            ServerAdmin webmaster@localhost
            LogLevel warn
            ErrorLog /storage/logs/mainsite123.com/error_log
            CustomLog /storage/logs/mainsite123.com/access_log combined
            ServerSignature Off
    
            <Directory />
                    Options FollowSymLinks
                    AllowOverride All
            </Directory>
            <Directory /storage/www/mainsite123.com>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
            </Directory>
    </VirtualHost>
    
    # WP Install number 2
    <VirtualHost 192.168.0.0>
            ServerName mainsite456.com
            ServerAlias www.mainsite456.com
            ServerAlias *.mainsite456.com
    
            ServerAlias domain987.com
            ServerAlias www.domain987.com
            ServerAlias *.domain987.com
    
            ServerAlias domain654.com
            ServerAlias www.domain654.com
            ServerAlias *.domain654.com
    
            ServerAlias domain321.com
            ServerAlias www.domain321.com
            ServerAlias *.domain321.com
    
            DocumentRoot /storage/www/mainsite456.com
            ServerAdmin webmaster@localhost
            LogLevel warn
            ErrorLog /storage/logs/mainsite456.com/error_log
            CustomLog /storage/logs/mainsite456.com/access_log combined
            ServerSignature Off
    
            <Directory />
                    Options FollowSymLinks
                    AllowOverride All
            </Directory>
            <Directory /storage/www/mainsite456.com>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
            </Directory>
    </VirtualHost>

    The catch – I want to use Donncha’s WordPress MU Domain Mapping plugin to map multiple domains per installation.

    Yeah, there’s the catch. ?? IP addresses are dirt cheap, it’d make your job a LOT easier. Downside of what you’ve got: things will start slowing down the more domains you add.

    You’ve almost got it above. For each virtual host pointing to its own doc root, something like this:

    # WP Install number 2
    <VirtualHost 192.168.0.0>
            ServerName mainsite456.com
            ServerAlias https://www.mainsite456.com
            ServerAlias *.mainsite456.com,domain987.com, domain654.com, domain321.com
    
            DocumentRoot /storage/www/mainsite456.com
            ServerAdmin webmaster@localhost
            LogLevel warn
            ErrorLog /storage/logs/mainsite456.com/error_log
            CustomLog /storage/logs/mainsite456.com/access_log combined
            ServerSignature Off
    
            <Directory />
                    Options FollowSymLinks
                    AllowOverride All
            </Directory>
            <Directory /storage/www/mainsite456.com>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride All
                    Order allow,deny
                    allow from all
            </Directory>
    </VirtualHost>

    You only need those extra wildcards if you’re running multiple networks in one install. If you had an IP address for each install, you can put a wildcard in there, so ANY domain tossed at each IP will be caught by WP.

    I talked about this over the weekend at WordCamp Chicago. See slides here:
    https://www.slideshare.net/AndreaRennick/domain-mapping

    Specifically slides 19 thru 21.

    Thread Starter bdoreste

    (@bdoreste)

    [bows, as I received a reply from Andrea ;-)]

    Okay, so I only need the wildcard for the main site doc root, and not all of the other domains?

    I have set up two A-records in Godaddy DNS for the main site domain:

    @.mainsite456.com -> 192.168.0.0
    *.mainsite456.com -> 192.168.0.0

    where the second one is the wildcard (taking the place of what Matt has described at: https://ma.tt/2003/10/wildcard-dns-and-sub-domains/)

    I have followed Steps 1-3 on Otto’s post at:
    https://ottopress.com/2010/wordpress-3-0-multisite-domain-mapping-tutorial/

    My hang-up at the moment is getting the “Tools > Domain Mapping” menu option to show up. As of now, my admin panel DOES NOT display it.

    I have already created a second blog, but I don’t have a Tools > Domain Mapping menu to see it.

    what gives?

    Thread Starter bdoreste

    (@bdoreste)

    I should mention that I installed the trunk version of the domain mapping plugin for WP3.0 as Otto suggests, and not the version which is on the wordpress plugin download page.

    Make sure domain-mapping.php (the plugin file) is in the mu-plugins folder, NOT the usual plugins folder. If you don’t have a mu-plugins folder, make one. ??

    You shoudl also see a domain mapping plugin under the Super Admin menu.

    Okay, so I only need the wildcard for the main site doc root, and not all of the other domains?

    Yes that’s right, becasue you’re not using subdomains on the domains of the mapped blogs.

    Thread Starter bdoreste

    (@bdoreste)

    yep, I created a /wp-content/mu-plugins/ folder, and put the domain-mapping.php in it. sunrise.php is in /wp-content/

    file permissions on the mu-plugins folder are drwxr-xr-x, and permissions on sunrise.php and domain-mapping.php are -rw-r–r–

    define( 'SUNRISE', 'on' );
    is listed immediately after the multisite code in wp-config.php

    under “Super Admin > Domain Mapping”, I have selected the 2nd and 3rd options for “Permanent redirect (better for your blogger’s pagerank)” and “User domain mapping page”, but have left the 1st and 4th options for “Remote Login” and “Redirect administration pages to blog’s original domain (remote login disabled if redirect disabled)” unchecked.

    I’ll remove the wildcards on the mapped blog domains; thanks Andrea!

    Thread Starter bdoreste

    (@bdoreste)

    Otto was able to clue me onto what I was missing; I needed to log onto the wp-admin.php of the domain which I wanted to map, not the wp-admin.php of the main blog.

    Once I logged into the wp-admin.php of the blog I wanted to map, and then the “Tools > Domain Mapping” menu option was available to me. it wasn’t intuitive to me that I needed to log out of the main site admin, and then log into the mapped blog admin.

    Okay, to recap: within the wp-admin page of the main blog, go to “Super Admin > Sites” and add a site. For example, if you want to add a mapped domain called “domain123.com”, enter “domain123” under “Add Site > Site Address” (it will say “domain123.mainblog123.com”)

    Then, log out of the main site admin, and log into domain123.mainblog123.com/wp-admin.php Once inside of the admin for the new blog, then go to “Tools > Domain Mapping” and set domain123.com as primary domain. That should do it!

    did I miss anything? check out the related thread on Otto’s blog;
    https://ottopress.com/2010/wordpress-3-0-multisite-domain-mapping-tutorial/

    It seems to be working, except that the Sociable plugin is puking some errors on the mapped domain blog… will try to pin that problem down next.

    thanks again!

    Yes, there’s alos a menu under the Super Admin where you can map domains. It sounded from above that you were checking from the blog you wanted to map.

    I wrote about it a while ago here:
    https://wpwebhost.com/using-multiple-domains-with-wordpress-mu/

    It’s pretty much exactly the same in 3.0.

    I am not getting this?

    Why there are 3 config options…

    define( 'WP_ALLOW_MULTISITE', true );
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', true );

    And there was also a
    define( 'VHOST', true );

    Which is now deprecated by – define( 'SUBDOMAIN_INSTALL', true );

    Any clues?

    Thanks,
    -Rahul

    define( ‘WP_ALLOW_MULTISITE’, true );

    This turns on the Network menu item.

    define( ‘MULTISITE’, true );
    define( ‘SUBDOMAIN_INSTALL’, true );

    the first line lets WP know we’re running multiple sites.
    The second tell WP what kind of sites they are.

    And there was also a
    define( ‘VHOST’, true );

    Which is now deprecated by – define( ‘SUBDOMAIN_INSTALL’, true );

    The deprecated line is *only* if you were running MU. If you have a single WP install and then enabled the network, you will never get this line.

    Thanks Andrea. I am all clear now. ??

    By the way, I read in few thread that domain mapping can be done without domain-mapping-plugin itself.
    Can you please point out to any good tutorial which also highlights pros n cons of using domain mapping without any plugin.?

    There isn’t one that I know of. Not that highlights the pros & cons.

    I recommend using the plugin. It takes care of your logins & redirects, plus no manual database edits.

Viewing 15 replies - 1 through 15 (of 27 total)
  • The topic ‘multiple Multisite installs on single IP?’ is closed to new replies.