Roots Discourse

Multisite WordPress with different domains using bedrock

I’m trying setup WordPress using bedrock. It’s a multi-site setup where each site would have a different domain.

  • test.local - main blog
  • different.local - another blog

The problem I’m having is each of the blogs created just direct back to the main blog, as though they cannot be found.

I have set the following options in application .php

Config::define( 'WP_ALLOW_MULTISITE', true );
Config::define( 'MULTISITE', true );
Config::define( 'SUBDOMAIN_INSTALL', true );
Config::define( 'DOMAIN_CURRENT_SITE', env( 'DOMAIN_CURRENT_SITE' ) );
Config::define( 'PATH_CURRENT_SITE', env( 'PATH_CURRENT_SITE' ) ?: '/' );
Config::define( 'SITE_ID_CURRENT_SITE', env( 'SITE_ID_CURRENT_SITE' ) ?: 1 );
Config::define( 'BLOG_ID_CURRENT_SITE', env( 'BLOG_ID_CURRENT_SITE' ) ?: 1 );
Config::define( 'COOKIE_DOMAIN', '' );
Config::define( 'ADMIN_COOKIE_PATH', '/' );
Config::define( 'COOKIEPATH', '/' );
Config::define( 'SITECOOKIEPATH', '/' );

In my .env file I have those values defined:

WP_ENV=development
WP_HOME=http://test.local
WP_SITEURL=${WP_HOME}/wp
DOMAIN_CURRENT_SITE=test.local
PATH_CURRENT_SITE=/
SITE_ID_CURRENT_SITE=1
BLOG_ID_CURRENT_SITE=1

I’ve got the roots/multisite-url-fixer plugin added via Composer.

I’m using nginx, which has two server blocks defined in the .conf file.

    server {
        listen 80;
        server_name test.local;
        root /bedrock/web;
        index index.php;

        # Sub-directory rewrites
        rewrite ^/(wp-.*.php)$ /wp/$1 last;
        rewrite ^/(wp-(content|admin|includes).*) /wp/$1 last;

        location ~ \.php$ {
            fastcgi_pass  php;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            fastcgi_param HTTP_HOST $server_name;
            include fastcgi_params;
        }

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

    }

    server {
        listen 80;
        server_name different.local;
        root /bedrock/web;
        index index.php;

        # Sub-directory rewrites
        rewrite ^/(wp-.*.php)$ /wp/$1 last;
        rewrite ^/(wp-(content|admin|includes).*) /wp/$1 last;

        location ~ \.php$ {
            fastcgi_pass  php;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            fastcgi_param HTTP_HOST $server_name;
            include fastcgi_params;
        }

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

I’m not sure what I’ve missed. Would anyone know of documentation describing setting up WP multisite with bedrock, using nginx, where the different blogs can have different domains? I’ve been following this guide so far, but cannot access the different blogs yet.: https://wordpress.stackexchange.com/questions/251116/how-to-use-wordpress-multisite-with-different-domain-names

To follow up, what I’m seeing is that the additional sites I’m created just 404.