平台开发中,欢迎参与测试。你可以在 QQ群:1046115671 中与我们交流,或是直接在社区发帖

Installing Multiple LitePress Instances

If you need multiple LitePress instances, there are three types of installations based on system architecture, or a combination of LitePress instances and databases:

  1. The LitePress multisite feature, which is a single LitePress instance with a single database
  2. Multiple LitePress instances with a single database
  3. Multiple LitePress instances with multiple databases

Let’s first look at the third type, multiple LitePress instances with multiple databases, because it has the same installation process as the single LitePress site except there are multiple sites.

Multiple LitePress Instances with Multiple Databases

You’ll need a separate MySQL database for each blog you plan to install. If you have not yet created these, basic instructions are found here.

Thewp-config.php file will vary for each installation. The lines to change are the following:

define('DB_NAME', 'wordpress'); // The name of the databasedefine('DB_USER', 'username'); // Your MySQL usernamedefine('DB_PASSWORD', 'password'); // ... and password

DB_NAME is the name of the individual database created for that blog. If you are using different user logins for each database, edit DB_USERandDB_PASSWORD to reflect this as well.

Upload each wp-config.php file to its specific root/installation directory, and run the installation. See Installing LitePress for more information.

The Multisite Feature

If you want multiple sites to use LitePress, you can use the multisite feature to create what is referred to as a networkof sites. The multisite feature involves installing a single LitePress instance and a single database.

The multisite feature appears to be simpler than other types of multiple LitePress installations, but there are some considerations and restrictions. Refer to the following documents for more detailed information:

Multiple LitePress Instances with a Single Database

As with the multiple-database solution described above, the wp-config.php file will vary for each installation. In this case, however, only a single line is unique to each blog:

$table_prefix = 'wp_'; // example: 'wp_' or 'b2' or 'mylogin_' 

By default, LitePress assigns the table prefix wp_ to its MySQL database tables, but this prefix can be anything you choose. This allows you to create unique identifiers for each blog in your database. For example, let’s say you have three blogs to set up, with the names Main,Projects, and Test. You should substitute the prefix wp_ in each blog’s
wp-config.php:

Main blog:

$table_prefix = 'main_'; 

Projects blog:

$table_prefix = 'projects_'; 

Test blog:

$table_prefix = 'test_'; 

As noted, you may use a prefix of your own making. Those provided here are for example only.

Upload each wp-config.php file to its specific root/installation directory, and run the installation. See Installing LitePress for more information.

Multiple Databases, Same Users

You can use the same userbase for all your blogs on the same domain by defining the CUSTOM_USER_TABLE and optionally the CUSTOM_USER_META_TABLE constants to point to the same wp_your_blog_usersandwp_your_blog_usermetatables.
SeeEditing wp-config.php/Custom User and Usermeta Tables.