【问题标题】:WordPress multisite Nginx - Error establishing database connectionWordPress 多站点 Nginx - 建立数据库连接时出错
【发布时间】:2021-04-19 20:45:21
【问题描述】:

我正在 nginx 系统上设置 wordpress 多站点,具有顶级域,所以我试图得到:

  1. example1.com(主站点)
  2. example2.com

两者都应该重定向到同一个根,并使用不同的 D/B。

wp config:

/* Multisite */
define('WP_ALLOW_MULTISITE', true);


define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

define( 'COOKIE_DOMAIN', '' );
define( 'ADMIN_COOKIE_PATH', '/' );
define( 'COOKIEPATH', '/' );
define( 'SITECOOKIEPATH', '/' );

并在可用站点上配置以下内容: example2.com

server {
        server_name  example2.com;
        return 302 $scheme://example1.com$request_uri;
}

server {
    server_name example2.com www.example.2com
    root /home/domains/example1/public_html;
        index index.php;
    include global/restrictions.conf;
 #   include global/wordpress.conf;

}

第一个域工作正常, 在第二个域上,我得到“建立数据库连接时出错”。

【问题讨论】:

    标签: wordpress nginx multisite


    【解决方案1】:

    确保您的多站点和 DNS 配置正确后,我建议在您的 cli 上使用wp db reset,然后重新导入您的数据库。我遇到了多站点的各种问题,其中数据库在导入时有自己的想法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-02
      • 2020-01-04
      • 2019-02-10
      • 2021-05-28
      • 1970-01-01
      • 2015-08-11
      • 2012-12-29
      • 1970-01-01
      相关资源
      最近更新 更多