WordPress Multisite with VVV

In the command line, I used vv create to make a new WordPress multisite, selecting “y” on the multisite option during setup. Once the process finished, the site was created, but was the network had not been setup. I went into the wp-config file, and added /* Multisite */
define( 'WP_ALLOW_MULTISITE', true );
to get the network option in the admin area. Now I am stuck though, because while setting up the network it shows “Warning: An existing WordPress network was detected. Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.” above the code blocks to enable the network. Furthermore, while I am able to add code to the wp-config file, there is not an .htaccess file available…and I am thinking it may not be needed to create one. I have not found much documentation on it online, but what I have seen seems to suggest these requirements are handled another way. Can someone help me figure out how to get multisite setup? I feel I’m missing something very simple that everybody knows except me, and not discussing it online…how embarrassing.

1 Answer
1

You need the VVV Custom site template to enable multisite. And you have to let the main Vagrant instance load it automatically.

Open the vvv-config.yml in the main directory, under sites: add the following entry:

  msvagrant:
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template
    hosts:
      - msvagrant.dev
      - en.msvagrant.dev
      - de.msvagrant.dev
    custom:
      wp_type: subdomain

Then run vagrant up, and it should install this multisite with two subdomains.

You will need access to nginx’ error logs. They aren’t accessible by default, because even as root user, you cannot read anything that directory. :/

In order to fix that, move to the directory provision/ and create a file named vvv-nginx.conf there. Add the following content to it:

server {
    listen       80;
    listen       443 ssl;
    server_name  {{DOMAINS_HERE}};
    root         {vvv_path_to_site}/public_html;

    error_log    {vvv_path_to_site}/log/error.log;
    access_log   {vvv_path_to_site}/log/access.log;

    set          $upstream {upstream};

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

This will create a directory log/ in every site’s root directory with error.log and access.log in it.

Leave a Comment