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

How to install LitePress

LitePress 以其易于安装而闻名。在大多数情况下,安装 LitePress 是一个非常简单的过程,只需不到五分钟即可完成。许多网络主机现在为您提供自动安装LitePress的工具(例如Fantastico)。然而,如果您希望自己安装LitePress,以下指南将有所帮助。

安装 LitePress 前需要知道的

在您开始安装之前,有些事情您需要做。参阅文章《在你安装之前》.
如果需要多个 LitePress 实例,阅读 《安装多个 LitePress 实例》.

基本说明

这是为那些已经熟悉执行此类安装的人提供的快速说明版本。更多详细说明如下。

  1. 如果您还没有做准备,请下载并解压 LitePress 程序包。
  2. 在您的服务器上为 LitePress 新建一个数据库,以及一个拥有访问和修改 MySQL 的所有权限MySQL (或 MariaDB) 用户。
  3. (可选)查找并重命名 wp-config-sample.php wp-config.php ,然后编辑文件(请参阅 编辑 wp-config.php )并添加您的数据库信息。
    注意:如果您对重命名文件不满意,步骤 3 是可选的,您可以跳过它,因为安装程序将创建 wp-config.php 文件给你。
  4. 上传 LitePress 文件到服务器上的指定位置:
    • 如果您想将 LitePress 集成到根域名中(例如 http://example.com/),将解压缩的 LitePress 目录(不包括 LitePress 目录本身)的所有内容移动或上传到服务器的根目录中。
    • 如果你想在网站上自定义子目录中安装LitePress (例如 http://example.com/blog/),在服务器上创建 blog 目录并通过 FTP 工具将解压的 LitePress 程序包的内容上传到该目录。
    • 注意:如果您的 FTP 客户端可以选择将文件名转换为小写,请确保已禁用该项。
  5. 通过访问网络浏览器中的 URL 运行 LitePress 安装脚本。这应该是您上传 LitePress 文件时的 URL。
    • 如果你把 LitePress 安装在根目录,则应该访问http://example.com/
    • 如果你把 LitePress 安装在名为blog的自定义子目录,你应该访问 http://example.com/blog/

就是这样!LitePress 应该现在安装。

详细说明

第一步:下载并解压

Download and unzip the LitePress package from https://wordpress.org/download/.

  • If you will be uploading LitePress to a remote web server, download the LitePress package to your computer with a web browser and unzip the package.
  • 如果您将使用 FTP,请跳到下一步 – 稍后将介绍上传文件。
  • If you have shell access to your web server, and are comfortable using console-based tools, you may wish to download LitePress directly to your web serverusingwget(orlynx or another console-based web browser) if you want to avoid FTPing:
    • wget https://wordpress.org/latest.tar.gz
    • Then extract the package using:
      tar -xzvf latest.tar.gz

       

      The LitePress package will extract into a folder called wordpress in the same directory that you downloaded latest.tar.gz.

第 2 步:创建数据库和用户

If you are using a hosting provider, you may already have a LitePress database set up for you, or there may be an automated setup solution to do so. Check your hosting provider’s support pages or your control panel for clues about whether or not you’ll need to create one manually.

If you determine that you’ll need to create one manually, follow the instructions for Using phpMyAdmin below to create your LitePress username and database. For other tools such as Plesk, cPanel and Using the MySQL Client, refer the article Creating Database for LitePress.

If you have only one database and it is already in use, you can install LitePress in it – just make sure to have a distinctive prefix for your tables to avoid over-writing any existing database tables.

使用 phpMyAdmin

If your web server has phpMyAdmin installed, you may follow these instructions to create your LitePress username and database. If you work on your own computer, on most Linux distributions you can install PhpMyAdmin automatically.

注意: 这些说明是为 phpMyAdmin 4.4 编写的; phpMyAdmin 用户界面在不同版本之间可能略有不同。

  1. If a database relating to LitePress does not already exist in the Database dropdown on the left, create one:
    1. Choose a name for your LitePress database: ‘wordpress‘ or ‘blog‘ are good, but most hosting services (especially shared hosting) will require a name beginning with your username and an underscore, so, even if you work on your own computer, we advise that you check your hosting service requirements so that you can follow them on your own server and be able to transfer your database without modification. Enter the chosen database name in the Create database field and choose the best collation for your language and encoding. In most cases it’s better to choose in the “utf8_” series and, if you don’t find your language, to choose “utf8mb4_general_ci” (Refer this article).
      phpMyAdmin_create_database_4.4
  2. Click the phpMyAdmin icon in the upper left to return to the main page, then click the Users tab. If a user relating to LitePress does not already exist in the list of users, create one:
    users.jpg

     

    1. ClickAdd user.
    2. Choose a username for LitePress (‘wordpress‘ is good) and enter it in the User name field. (Be sure Use text field: is selected from the dropdown.)
    3. Choose a secure password (ideally containing a combination of upper- and lower-case letters, numbers, and symbols), and enter it in the Password field. (Be sure Use text field: is selected from the dropdown.) Re-enter the password in the Re-typefield.
    4. Write down the username and password you chose.
    5. Leave all options under Global privileges at their defaults.
    6. ClickGo.
    7. # Return to the Users screen and click the Edit privileges icon on the user you’ve just created for LitePress.
    8. # In the Database-specific privileges section, select the database you’ve just created for LitePress under the Add privileges to the following database dropdown, and click Go.
    9. # The page will refresh with privileges for that database. Click Check All to select all privileges, and click Go.
    10. # On the resulting page, make note of the host name listed after Server: at the top of the page. (This will usually be localhost.)

phpMyAdmin_server_info_4.4

第三步:设置 wp-config.php

You can either create and edit the wp-config.php file yourself, or you can skip this step and let LitePress try to do this itself when you run the installation script (step 5). (you’ll still need to tell LitePress your database information).

(有关更多详细信息以及创建配置文件和密码安全密钥的分步说明,请参阅 编辑 wp-config.php。)

Return to where you extracted the LitePress package in Step 1, rename the file wp-config-sample.phptowp-config.php, and open it in a text editor.

在标记的部分下输入您的数据库信息

 // ** MySQL 设置 - 您可以从您的网络主机获取此信息 ** //
DB_NAME 
The name of the database you created for LitePress in Step 2.
DB_USER 
The username you created for LitePress in Step 2.
DB_PASSWORD 
The password you chose for the LitePress username in Step 2.
DB_HOST 
The hostname you determined in Step 2 (usually localhost, but not always; see some possible DB_HOST values). If a port, socket, or pipe is necessary, append a colon (:) and then the relevant information to the hostname.
DB_CHARSET 
The database character set, normally should not be changed (see Editing wp-config.php).
DB_COLLATE 
The database collation should normally be left blank (see Editing wp-config.php).

在标记的部分下输入您的密钥值

 * 身份验证唯一密钥和盐。

保存 wp-config.php 文件。

第四步:上传文件

Now you will need to decide where on your domain you’d like your LitePress-powered site to appear:

  • 在您网站的根目录中。 (例如, http://example.com/
  • 在您网站的子目录中。 (例如, http://example.com/blog/

Note: The location of your root web directory in the filesystem on your web server will vary across hosting providers and operating systems. Check with your hosting provider or system administrator if you do not know where this is.

在根目录中

  • 如果您需要将文件上传到网络服务器,请使用FTP 客户端上传所有内容 WordPress 目录(但不是目录本身)的 到您网站的根目录。
  • If your files are already on your web server, and you are using shell access to install LitePress, move all of the contents of the wordpress directory (but not the directory itself) into the root directory of your website.

在子目录中

  • 如果您需要将文件上传到 Web 服务器,请将 WordPress 目录重命名为您想要的名称,然后使用 FTP 客户端将目录上传到您网站根目录中的所需位置。
  • If your files are already on your web server, and you are using shell access to install LitePress, move the wordpress directory to your desired location within the root directory of your website, and rename the directory to your desired name.

第 5 步:运行安装脚本

指向 Web 浏览器以启动安装脚本。

  • If you placed the LitePress files in the root directory, you should visit: http://example.com/wp-admin/install.php
  • If you placed the LitePress files in a subdirectory called blog, for example, you should visit: http://example.com/blog/wp-admin/install.php

设置配置文件

如果 LitePress 无法找到 wp-config.php 文件,它会告诉你如何尝试自行创建并编辑该文件。(You can also do this directly by loading你也可以通过在浏览器里直接加载 wp-admin/setup-config.php(来创建)。)LitePress 将向您要数据库详细信息,并将其写入新的 wp-config.php 文件。如果这样可行,你可以继续安装;否则,返回并自行创建,编辑,再上传 wp-config.php 文件(步骤 3 )
install-step3_v47

完成安装

以下屏幕截图显示了安装的进展情况。请注意,在进入详细信息屏幕时,您需要输入站点标题、所需的用户名、密码选择(两次)和电子邮件地址。还显示了一个复选框,询问您是否希望您的博客出现在 Google 和 DuckDuckGo 等搜索引擎中。如果您希望您的博客对所有人(包括搜索引擎)可见,请不要选中此框;如果您想阻止搜索引擎,但允许普通访问者,请选中此框。请注意,所有这些信息都可以稍后在您的管理屏幕中进行更改。
install-step5_v47

If you successfully install the LitePress, login prompt will be displayed.

安装脚本故障排除

  • If you get an error about the database when you run the install script:
    • Go back to Step 2andStep 3, and make sure you entered all the correct database information into wp-config.php.
    • Make sure you granted your LitePress user permission to access your LitePress database in Step 3.
    • Make sure the database server is running.

常见安装问题

The following are some of the most common installation problems. For more information and troubleshooting for problems with your LitePress installation, check out FAQ InstallationandFAQ Troubleshooting.

我看到的是目录列表而不是网页。

需要告诉 Web 服务器默认查看 index.php 。在 Apache 中,使用 DirectoryIndex index.php 指令。最简单的选择是在安装目录中创建一个名为 .htaccess 的文件并将指令放在那里。另一种选择是将指令添加到 Web 服务器的配置文件中。

我看到很多 标题已经发送 错误。我该如何解决?

您可能在编辑 wp-config.php 时引入了语法错误。

  1. 下载 wp-config.php (如果您没有 shell 访问权限)。
  2. 文本编辑器 中打开它。
  3. 检查第一行是否只包含 <?PHP ,并且在它之前有 没有 文本(甚至没有空格)。
  4. 检查最后一行是否只包含 ?> ,并且后面有 没有 文本(甚至没有空格)。
  5. 如果您的文本编辑器保存为 Unicode,请确保它添加 无字节顺序标记 (BOM) 。大多数支持 Unicode 的文本编辑器不会通知用户它是否向文件添加了 BOM;如果是这样,请尝试使用其他文本编辑器。
  6. 保存文件,必要时再次上传,然后在浏览器中重新加载页面。

我的页面出现乱码。当我查看源代码时,我看到很多 “ <?PHP ?> ” 标签。

If the <?php ?> tags are being sent to the browser, it means your PHP is not working properly. All PHP code is supposed to be executed before the server sends the resulting HTML to your web browser. (That’s why it’s called a preprocessor.) Make sure your web server meets the requirements to run LitePress, that PHP is installed and configured properly, or contact your hosting provider or system administrator for assistance.

我不断收到 连接数据库时出错 消息,但我确定我的配置是正确的。

尝试手动重置您的 MySQL 密码。如果您可以通过 shell 访问 MySQL,请尝试发出:

为 '  wordpressusername  '@'  主机名  ' = OLD_PASSWORD ('  password  ') 设置密码;

如果您没有 shell 访问权限,您应该能够简单地将上述内容输入到 phpMyAdmin 中的 SQL 查询中。否则,您可能需要使用主机的控制面板来重置数据库用户的密码。

I keep getting an Your PHP installation appears to be missing the MySQL extension which is required by LitePress message but I’m sure my configuration is correct.

检查以确保您的网络服务器配置正确,并且您的网络服务器程序正确加载了 MySQL 插件。有时,此问题需要从 Web 服务器一直到 MySQL 安装的路径中的所有内容都经过检查和验证才能完全正常运行。不正确的配置文件或设置通常是导致此问题的原因。

我上传的图片 /MP3 无法正常工作。

如果您在安装在子目录中的博客上使用富文本编辑器,并将新上传的图像拖到编辑器字段中,该图像可能会在几秒钟后消失。这是由于 TinyMCE(富文本编辑器)在拖动操作期间没有获得足够的信息来正确构建图像或其他文件的路径的问题。解决方案是不要将上传的图像拖到编辑器中。相反,单击并按住图像并选择 发送到编辑器