0

I'm building a multi-site project locally using the VVV Vagrant VM.

I setup a sub-domain multisite install with domain mapping and two sub-sites. Everything works fine. This was my sandbox that I used to get started and figure things out.

Now I've setup a new, exact replica (obviously URLS are different) of that working multi-site network on the same VM. Everything seems fine with the primary site, but when I create a new sub-site, its broken. I'm getting 404s for the admin and front end.

It's quite confusing since the setups are identical. Same configurations and vhost in nginx. Same configuration files for Wordpress config, etc. I've checked and re-checked everything.

So my question is: Are there any issues trying to run two or more instances of wordpress multi-site on the same box, IE the same MySQL instance. I understand Wordpress uses the same database to add blogs to the network, and just creates new tables with a blog-ID prefix. I just cannot seem to uncover the issue here.

Thanks for the help.

Ok, now that I've confirmed that this is possible lets go deeper.

I've already included the proper rewrites in nginx, which are seen below. Both sites use similar rewrites.

VHOST:

server {
    # Determines the port number that nginx will listen to for this
    # server configuration. 80 is the default http port.
    listen       80;

    # Listen for HTTPS requests as well
    # listen       443 ssl;

    # Tells nginx what domain name should trigger this configuration. If
    # you would like multiple domains or subdomains, they can be space
    # delimited here. See http://nginx.org/en/docs/http/server_names.html
    server_name  agency.dev *.agency.dev;

    server_name_in_redirect    off;

    # Tells nginx which directory the files for this domain are located
    root         /srv/www/agency/web;

    ######################################
    ##  Testing rewrites to remove /wp ###
    ######################################

    rewrite /wp-admin$ $scheme://$host$uri/ last;
    rewrite ^/(wp-.*.php)$ /wp/$1 last;
    rewrite ^/(wp-(content|admin|includes).*) /wp/$1 last;

    # Includes a basic WordPress configuration to help with the common
    # rules needed by a web server to deal with WordPress properly.

    include /etc/nginx/nginx-wp-common.conf;
}

Above you'll notice the rewrites which remove /wp from the site URL. I'm using this rewrite because I have wordpress core files in a sub-directory, as this project is setup using Roots theme with Bedrock.

I did notice when I installed the network it failed the wildcard DNS test. Which is odd since theres a wildcard entry in my virtual host file.

closed as off-topic by Tom J Nowell Jul 9 '14 at 17:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • You've included the vvv-nginx.conf for one site, but you mentioned multiple multisite installs, where is the other? Also, host files don't accept wildcards, Nginx can be told to take them but you have to define all subdomains, a wildcard wont work – Tom J Nowell Jul 9 '14 at 15:33
2

No, there should be no issues running multiple multisite installs in a single VVV setup. I have at least 4 multisite installations running on my machine as I type this.

Your issue is likely either because your multi-sites are identical, and share database tables and/or URLs, or, you've added a subdomain site and you now need to re-provision VVV to get the new subdomain in your HOST file and in NGINX.

Try running this from the command line:

vagrant halt; vagrant up --provision

And make sure that your 2 installs have separate tables/database names/URLs. A VVV set up will give you a standard server stack with Nginx, for which there is nothing special other than how it's provisioned.

  • I did re-provision, and had this setup using the vvv-auto host files. Didn't solve my problem. It's worth noting I built a quick theme for the primary site BEFORE installing the multi-site network. Not sure that would have any impact. – KJ Prince Jul 9 '14 at 15:25
  • And those vvv- auto files are set up for 2 separate unique sites and there is no duplication inside them of URLs or database details etc? Are you sure the 2 sites are indeed separate self contained sites, with everything copied and nothing shared? – Tom J Nowell Jul 9 '14 at 15:32
  • Solved. Turns out it was an issue with my Mac OSX hosts file. To solve it I just did the following: sudo nano /etc/hosts I added the following: 192.160.58.3 example.dev 192.169.58.3 subsite.example.dev 192.169.58.3 *.example.dev For whatever reason adding the subsite.example.dev to the hosts file solved it. The wildcard wasn't doing its job. Not sure why. – KJ Prince Jul 9 '14 at 15:36
  • As I mentioned, you can't put wildcards in the hosts file, it doesn't work, *.example.dev is not a valid hosts file entry – Tom J Nowell Jul 9 '14 at 17:39

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