I've runned across issue with Wordpress Multisite.
The project is WordPress Multisite with Subdomains, running on the same /
root folder.
VPS is running Centos 7 with VestaCP. We are using NGINX for web-service. Project runs via SSL (https://).
Basically whenever I try to visit Main Domain Network Dashboard https://sub.domain.com/wp-admin/network i get redirection error.
The page isn’t redirecting properly
I've checked and outruled following possible issues:
0644
and folders 0755
+ it's assigned to VestaCP username domain_user
)I suspect it's due to issue in nginx subdomain.domain.ssl.conf
config file but I can't figure out what exactly. Here is the content of the config file - it is by default the VestaCP Web Template: Wordpress2_rewrite
server {
listen 37.201.93.62:443;
server_name sub.domain.com one.sub.domain.com two.sub.domain three.sub.domain;
root /home/domain_user/web/sub.domain.com/public_html;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/sub.domain.com.log combined;
access_log /var/log/nginx/domains/sub.domain.com.bytes bytes;
error_log /var/log/nginx/domains/sub.domain.com.error.log error;
ssl on;
ssl_certificate /home/domain_user/conf/web/ssl.sub.domain.com.pem;
ssl_certificate_key /home/domain_user/conf/web/ssl.sub.domain.com.key;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
try_files $uri $uri/ /index.php?$args;
if (!-e $request_filename)
{
rewrite ^(.+)$ /index.php?q=$1 last;
}
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
location ~ [^/]\.php(/|$) {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
fastcgi_pass 127.0.0.1:9002;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias /home/domain_user/web/sub.domain.com/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
location /vstats/ {
alias /home/domain_user/web/sub.domain.com/stats/;
include /home/domain_user/web/sub.domain.com/stats/auth.conf*;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include /home/domain_user/conf/web/nginx.sub.domain.com.conf*;
}
This works fine on /wp-admin
hovewer not on /wp-admin/network
URLS This is configuration wp-config.php
file content:
<?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://codex.wordpress.org/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', 'dbname');
/** MySQL database username */
define('DB_USER', 'root');
/** MySQL database password */
define('DB_PASSWORD', 'pass');
/** 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', 'ARhaa6zreusFJ2VWkuP+l+v]&JEa3kQ|HUn4[|PA:E%k&B|J_mm-?s---&Hew0x7');
define('SECURE_AUTH_KEY', '$23xN:I#`0vQDff_t5Ogk*--h,:^@-0>r6_#,eQL=bc(##uwO&+|i]I<7[KpB%.?');
define('LOGGED_IN_KEY', '9c3qJwhQxx:`|gP^.Y6>d{.;(,95#x@fgHH~#/?>K_jie<iz$mgD1E y;!|Nr~LV');
define('NONCE_KEY', '<8Dh+67o;Pg7m_=++wa!0G+~H$p#Fq|ytwA,fBu~e}9`P.m|;?2&-^wM@Rq~[=?<');
define('AUTH_SALT', ')*YP~hQ]sRn0;^+ApMmj/$);<~?:>vHhc080or<}MRM$a4#%*CEkC//;~GAFzP^-');
define('SECURE_AUTH_SALT', 'uX|45M7~=xKJo`GIoE|:;A[Dl2Sg.Z?w^+HfgLMF3*f5`h*>MT] j7.% X_t6n{7');
define('LOGGED_IN_SALT', 'I!NZC^][EM-<+d_6j3G{l2-0ba16YEM-&z$|Y`8qM>/<M]GPz)::~b/|+xPigr?u');
define('NONCE_SALT', '-Vw#PgM@)P|2+U_x]J! 4+F-IZpe+y@Z~W}({D lPOHTH8hq%=#mse.77Ziw@);{');
/**#@-*/
/**
* 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 Codex.
*
* @link https://codex.wordpress.org/Debugging_in_WordPress
*/
define('WP_DEBUG', true);
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
define('WP_MEMORY_LIMIT', '256M');
/* Multisite */
define( 'WP_ALLOW_MULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'sub.domain.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
define('ALLOW_UNFILTERED_UPLOADS', true);
define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');
if ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' )
{
$_SERVER['HTTPS'] = 'on';
$_SERVER['SERVER_PORT'] = 443;
}
/* That's all, stop editing! Happy blogging. */
/** Absolute path to the WordPress directory. */
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
I've double checked - this config works fine and doesn't cause any issue.
At this point I'm really lost and can't figure out how to fix the issue. Whenever I try to visit https://sub.domain.com/wp-admin/network/update-core.php i am redirected to https://sub.domain.com/wp-admin/network and get redirection error:
I'm hoping on your help! Thanks in advance.
[EDITED]
I just noticed when visiting https://one.sub.domain.com Dashboard and hovering for Network link, it returns https://wp-admin/network/ which clearly shows misconfiguration of nginx.
[Possible issue & solution]
Soo i debuged once again and my wp-content/debug.log
contained these lines
[07-Jan-2019 23:55:19 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:19 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:19 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:19 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:19 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:20 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:20 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:20 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:20 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:20 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:21 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:21 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:21 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:21 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:21 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:22 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:22 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:22 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:22 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
[07-Jan-2019 23:55:22 UTC] PHP Notice: Trying to get property 'domain' of non-object in /home/domain_user/web/sub.domain.com/public_html/wp-admin/network/admin.php on line 20
And in /wp-admin/network/admin.php
file I commented out line 20
:
$redirect_network_admin_request = 0 !== strcasecmp( $current_blog->domain, $current_site->domain ) || 0 !== strcasecmp( $current_blog->path, $current_site->path );
which fixed the issue, but clearly it will mess up the Network Admin Request Redirection soo now the question is - HOW TO FIX THIS PROPERLY?