Hello everybody. I’m having a heck of a time installing multisite WordPress. I have been working on it for about 2 weeks and have hit a number of errors. I’ve perused forums, blogs and help articles, trying any suggestion available. Progress has been made, but it’s not working in its entirety, yet.
URL Info
https://www.draggoo.com
https://www.draggoo.com/~kevin
https://www.draggoo.com/wordpress
https://www.draggoo.com/wordpress/kevin
Each family member will have their own blog, which is why we have multisite set up. In theory, we could have the following:
https://www.draggoo.com/wordpress/sarah
etc.
Environment
Gentoo nginx MariaDB WordPress
nginx configuration file is in:
/etc/nginx/nginx.cong
root example.com folder is in:
/var/www/localhost/htdocs
WordPress is installed in:
/var/www/localhost/htdocs/wordpress
Current Problem
https://www.draggoo.com/wordpress/kevin doesn’t have any formatting
https://www.draggoo.com/wordpress/kevin/wp-admin/ shows to many redirects
Other Current Behaviors
https://www.draggoo.com works
https://www.draggoo.com/~kevin works
https://www.draggoo.com/wordpress works
https://www.draggoo.com/wordpress/wp-admin works
Notes
I don’t care about Draggoo.com. It currently has a link to the wordpress site, and that’s it.
I also don’t care about Draggoo.com/~kevin . I built it over 10 years ago using iWeb. It’s there for archiving purposes.
Files
(Sensitive information has been stripped)
(I hope the formatting turns out okay.)
nginx.conf
user nginx nginx;
worker_processes 1;
error_log /var/log/nginx/error_log info;
events {
worker_connections 1024;
use epoll;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main
'$remote_addr - $remote_user [$time_local] '
'"$request" $status $bytes_sent '
'"$http_referer" "$http_user_agent" '
'"$gzip_ratio"';
client_header_timeout 10m;
client_body_timeout 10m;
send_timeout 10m;
connection_pool_size 256;
client_header_buffer_size 1k;
large_client_header_buffers 4 2k;
request_pool_size 4k;
gzip off;
output_buffers 1 32k;
postpone_output 1460;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 75 20;
ignore_invalid_headers on;
map $uri $blogname{
~^(?P<blogpath>/[^/]+/)files/(.*) $blogpath ;
}
map $blogname $blogid{
default -999;
kevin 2;
#Ref: https://wordpress.org/extend/plugins/nginx-helper/
#include /var/www/wordpress/wp-content/plugins/nginx-helper/map.conf ;
}
# Redirects all http requests to https
server {
listen 80;
listen [::]:80;
server_name draggoo.com www.draggoo.com;
return 301 https://www.draggoo.com$request_uri;
}
# WED-
# Adding this to redirect all non-www.-having URLs to www.
server {
listen 443 ssl;
server_name draggoo.com;
ssl_certificate xxx.crt;
ssl_certificate_key xxx.key;
return 301 https://www.draggoo.com$request_uri;
}
# Server settings for all https requests
server {
# http ports and URLs these server details will apply to
# listen 127.0.0.1;
# listen 443 ssl http2;
listen 443;
# List of server names
server_name www.draggoo.com;
# SSL config - See https://www.bjornjohansen.com/securing-nginx-ssl for reference
ssl_certificate xxx.crt;
ssl_certificate_key xxx.key;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 180m;
ssl_protocols TLSv1.2 TLSv1.3; #TLS v1.0 and v1.1 were deprecated in 2020
ssl_prefer_server_ciphers on;
ssl_ciphers xxx;
ssl_dhparam xxx.pem;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
# Location of log files
access_log /var/log/nginx/localhost.access_log main;
error_log /var/log/nginx/localhost.error_log debug;
rewrite_log on;
# Location of files for draggoo.com site
root /var/www/localhost/htdocs;
include global/restrictions.conf;
location ~ ^/~(.+?)(/.*)?$ {
# Location of files for any URI that starts with a tilde (~) (ex: draggoo.com/~kevin will use files from /home/kevin/public_html/
alias /home/$1/public_html$2;
}
location ~ ^(/[^/]+)?/files/(.+) {
try_files /wordpress/wp-content/blogs.dir/$blogid/files/$2 /wordpress/wp-includes/ms-files.php?file=$2 ;
access_log off; log_not_found off; expires max;
}
#avoid php readfile()
location ^~ /wordpress/blogs.dir {
internal;
alias /var/www/localhost/htdocs/wordpress/wp-content/blogs.dir ;
access_log off; log_not_found off; expires max;
}
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host/wordpress$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) /wordpress$2 last;
rewrite ^(/[^/]+)?(/.*\.php) /wordpress$2 last;
}
# location @wp {
# rewrite ^/wordpress(.*) /wordpress/index.php?$1;
# }
location ^~ /wordpress {
index index.php index.html index.htm;
try_files $uri $uri/ /wordpress/index.php?$args;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi.conf;
# include fastcgi_params;
try_files $uri =404;
fastcgi_pass unix:/run/php-fpm.socket;
}
}
location / {
try_files $uri $uri/ /wordpress/index.php?$args ;
}
location ~ \.php$ {
include /etc/nginx/fastcgi.conf;
try_files $uri =404;
fastcgi_pass unix:/run/php-fpm.socket;
}
}
}
restrictions.conf
# Global restrictions configuration file.
# Designed to be included in any server {} block.
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~ /\/\. {
deny all;
}
# Deny access to any files with a .php extension in the uploads directory
# Works in sub-directory installs and also in multisite network
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
wp-config.php
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://wordpress.org/support/article/editing-wp-config-php/
*
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );
/** MySQL database username */
define( 'DB_USER', 'xxx' );
/** MySQL database password */
define( 'DB_PASSWORD', 'xxx' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
/**#@+
* Authentication Unique Keys and Salts.
*
* Change these to different unique phrases!
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
* You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
*
* @since 2.6.0
*/
define( 'AUTH_KEY', 'xxx' );
define( 'SECURE_AUTH_KEY', 'xxx' );
define( 'LOGGED_IN_KEY', 'xxx' );
define( 'NONCE_KEY', 'xxx' );
define( 'AUTH_SALT', 'xxx' );
define( 'SECURE_AUTH_SALT', 'xxx' );
define( 'LOGGED_IN_SALT', 'xxx' );
define( 'NONCE_SALT', 'xxx' );
/**#@-*/
/**
* WordPress Database Table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the documentation.
*
* @link https://wordpress.org/support/article/debugging-in-wordpress/
*/
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', '/tmp/wp-debug.log');
/* URL Locations */
/* Always use HTTPS */
$_SERVER['HTTPS']='on';
/** SSL */
define('FORCE_SSL_ADMIN', true);
/* Multisite */
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'www.draggoo.com');
define('PATH_CURRENT_SITE', '/wordpress/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
/* That's all, stop editing! Happy publishing. */
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
db.wp_options.home
MariaDB [wordpress]> select * from wp_options where option_name = 'home';
+-----------+-------------+-----------------------------------+----------+
| option_id | option_name | option_value | autoload |
+-----------+-------------+-----------------------------------+----------+
| 2 | home | https://www.draggoo.com/wordpress | yes |
+-----------+-------------+-----------------------------------+----------+
1 row in set (0.000 sec)
db.wp_2_options.home
MariaDB [wordpress]> select * from wp_2_options where option_name = 'home';
+-----------+-------------+-----------------------------------------+----------+
| option_id | option_name | option_value | autoload |
+-----------+-------------+-----------------------------------------+----------+
| 2 | home | https://www.draggoo.com/wordpress/kevin | yes |
+-----------+-------------+-----------------------------------------+----------+
1 row in set (0.000 sec)
db.wp_options.siteurl
MariaDB [wordpress]> select * from wp_options where option_name = 'siteurl';
+-----------+-------------+-----------------------------------+----------+
| option_id | option_name | option_value | autoload |
+-----------+-------------+-----------------------------------+----------+
| 1 | siteurl | https://www.draggoo.com/wordpress | yes |
+-----------+-------------+-----------------------------------+----------+
1 row in set (0.000 sec)
db.wp_2_options.siteurl
MariaDB [wordpress]> select * from wp_2_options where option_name = 'siteurl';
+-----------+-------------+-----------------------------------------+----------+
| option_id | option_name | option_value | autoload |
+-----------+-------------+-----------------------------------------+----------+
| 1 | siteurl | https://www.draggoo.com/wordpress/kevin | yes |
+-----------+-------------+-----------------------------------------+----------+
1 row in set (0.000 sec)
db.wp_blogs
MariaDB [wordpress]> select * from wp_blogs;
+---------+---------+-----------------+-------------------+---------------------+---------------------+--------+----------+--------+------+---------+---------+
| blog_id | site_id | domain | path | registered | last_updated | public | archived | mature | spam | deleted | lang_id |
+---------+---------+-----------------+-------------------+---------------------+---------------------+--------+----------+--------+------+---------+---------+
| 1 | 1 | www.draggoo.com | /wordpress/ | 2020-06-04 23:52:39 | 0000-00-00 00:00:00 | 1 | 0 | 0 | 0 | 0 | 0 |
| 2 | 1 | www.draggoo.com | /wordpress/kevin/ | 2020-06-15 03:30:50 | 2020-06-15 03:30:50 | 1 | 0 | 0 | 0 | 0 | 0 |
+---------+---------+-----------------+-------------------+---------------------+---------------------+--------+----------+--------+------+---------+---------+
2 rows in set (0.000 sec)
.htaccess
I deleted this file since I’m using nginx.
Final Thoughts
I prefer to know the “why” for changes instead of blindly trying different options, though I’m not opposed to suggestions based on experience.
And thank you in advance for your help!
~Kevin