Notes on getting Multisite working on Digital Ocean

I previously set up multisite locally however now when I have tried to set it up remotely after deploy completes attempts to access the site are redirected ie from:

http://XXX.XXX.XX.XXX

to

http://XXX.XXX.XX.XXX/wp-signup.php?new=XXX.XXX.XX.XXX

Error log shows:

2015/10/21
07:31:53 [error] 26077#0: *3 FastCGI sent in stderr: “PHP
message: WordPress database error Table ‘2p1mul_staging.wp_blogs’
doesn’t exist for query SELECT * FROM wp_blogs WHERE domain =
‘XXX.XXX.XX.XXX’ AND path = ‘/’ made by
require(‘wp-blog-header.php’), require_once(‘wp-load.php’),
require_once(‘/srv/www/XXX.XXX.XX.XXX/releases/20151021072844/web/wp-config.php’),
require_once(‘wp-settings.php’),
require(‘wp-includes/ms-settings.php’), get_site_by_path” while
reading response header from upstream, client: XXX.XXX.XX.XXX, server:
XXX.XXX.XX.XXX, request: “GET / HTTP/1.1”, upstream:
“fastcgi://unix:/var/run/php5-fpm-wordpress.sock:”, host:
“XXX.XXX.XX.XXX”

Among similar messages.

And that is because there are no tables:

root@test:/srv/www/XXX.XXX.XX.XXX/current/web/wp#
wp db tables --allow-root

WordPress
database error Table ‘2p1mul_staging.wp_blogs’ doesn’t exist for
query SELECT * FROM wp_blogs WHERE
domain = ‘’ AND path = ‘/’ made by
include(‘phar:///usr/bin/wp/php/boot-phar.php’),
include(‘phar:///usr/bin/wp/php/wp-cli.php’),
require(‘phar:///usr/bin/wp/php/wp-settings-cli.php’),
require(‘wp-includes/ms-settings.php’), get_site_by_path

Error:
Site not found.

Also shown here:

MariaDB
[XXXXX_staging]> SHOW TABLES;

Empty
set (0.00 sec)

And well I haven’t run ‘wp core install’ or installed from the browser so there are no tables but the thing is shouldn’t the install page be loading in the browser? Surely this redirect shouldn’t take priority over the install page? Which is what leads me to believe that I have done something stupid.

I have in the past set up local and remote single sites and local mutlisite however this is my first attempt at remote mutltisite (deploying the working local multisite), however due to not touching it for a month or more I think I am lost!

Can anyone give me any ideas of what I have done?

Below is my group_vars/staging/wordpress_sites.yml:

Documentation: https://github.com/roots/trellis#wordpress-sites

wordpress_sites:
XXX.XXX.XX.XXX:
site_hosts:
- XXX.XXX.XX.XXX
local_path: …/site # path targeting local Bedrock site directory (relative to Ansible root)
#repo: git@github.com:roots/bedrock.git
repo: git@github.com:XXXXX/XXXXX.com.git
branch: master
subtree_path: site # relative path to your Bedrock/WP directory in your repo (above) if its not the root (like the roots-example-project structure)
multisite:
enabled: true
subdomains: true
ssl:
enabled: false
cache:
enabled: false
duration: 30s
system_cron: true
env:
wp_home: http://XXX.XXX.XX.XXX
wp_siteurl: http://XXX.XXX.XX.XXX/wp
wp_env: staging
db_name: 2p1mul_staging
db_user: 2p1mul_dbuser
db_password: 2p1mul_dbpassword
domain_current_site: XXX.XXX.XX.XXX
# Generate your keys here: https://api.wordpress.org/secret-key/1.1/salt/
auth_key: “generateme”
secure_auth_key: “generateme”
logged_in_key: “generateme”
nonce_key: “generateme”
auth_salt: “generateme”
secure_auth_salt: “generateme”
logged_in_salt: “generateme”
nonce_salt: “generateme”

Thank you.

FYI I believe that you cannot host multisite on an IP address so please do not copy that idea from what I did above (I guess the periods in the IP catch out a regular expression re subdomains??). Ie you need a domain name.

I also had issues with WP-CLI search and replace not operating on some tables entires which I believe is what was causing a redirect loop (different from the redirect above, actually ignore everything above) ie after importing my local DB to the server these missed table entries in wp_blogs and I think wp_site resulted in the local URLs rather than remote in these entries causing the redirect loop. Not sure why this happened, could be something stupid on my part.

Off the top off my head it was these two main issues that I had to resolve to get the site up.

EDIT: Another thing that caught me out was needing to specify the URL when using WP-CLI with multisite (also mentioned in the thread linking this one which is what reminded me :stuck_out_tongue: )

I renamed this thread from:

Multisite redirect after deploy

to:

Notes on getting Multisite working on Digital Ocean (formerly “Multisite redirect after deploy” )

Hope that is ok guys.

1 Like

No problem, I renamed it completely :thumbsup:

1 Like