Я столкнулся с проблемой с Wordpress Multisite .
Проект WordPress Multisite с поддоменами , работающий в той же корневой папке /
.
- Мультисайт # 1 : https://one.sub.domain.com
- Мультисайт № 2 : https://two.sub.domain.com
- Мультисайт № 3 : https://three.sub.domain.com
- Основной домен : https://sub.domain.com
VPS работает на Centos 7 с VestaCP. Мы используем NGINX для веб-сервиса. Проект выполняется через SSL (https://).
Обычно, когда я пытаюсь посетить Основной домен Сетевая панель управления https://sub.domain.com/wp-admin/network Я получаю ошибку перенаправления.
Страница не перенаправляется должным образом
Я проверил и исключил следующие возможные проблемы:
- Не проблема с правами доступа к файлам / папкам (для файлов
0644
и папок 0755
+ он назначен VestaCP username domain_user
)
- Не конфигурация WordPress или ошибка базы данных.
- Все nginx и php пустые файлы журналов / ошибки не отображаются.
Я подозреваю, что это связано с проблемой в файле конфигурации nginx subdomain.domain.ssl.conf
, но я не могу понять, что именно. Вот содержимое файла конфигурации - по умолчанию это Веб-шаблон VestaCP : 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*;
}
Это прекрасно работает на /wp-admin
Hovewer, а не на /wp-admin/network
URL
Это конфигурация 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://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');
Я дважды проверил - эта конфигурация работает нормально и не вызывает никаких проблем.
На данный момент я действительно заблудился и не могу понять, как решить проблему.
Всякий раз, когда я пытаюсь посетить https://sub.domain.com/wp-admin/network/update-core.php, я перенаправляюсь на https://sub.domain.com/wp-admin/network и получаю ошибку перенаправления:
Я надеюсь на вашу помощь! Заранее спасибо.
[Изменено]
Я только заметил, что при посещении https://one.sub.domain.com Панели мониторинга и при наведении курсора на Сетевое соединение возвращается https://wp -admin / network / , что явно показывает неверную конфигурацию nginx.
[Возможная проблема и решение]
Так я снова отлаживал, и мой wp-content/debug.log
содержал эти строки
[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
А в /wp-admin/network/admin.php
файле я закомментировал line 20
:
$redirect_network_admin_request = 0 !== strcasecmp( $current_blog->domain, $current_site->domain ) || 0 !== strcasecmp( $current_blog->path, $current_site->path );
, которая устранила проблему, но, очевидно, она испортит Перенаправление запросов сетевого администратора soo теперь вопрос - КАК ИСПРАВИТЬ ЭТО СВОБОДНО?