如何在 CentOS 7 上安装 PHPList

在本教程中,我们将向您展示如何在您的 CentOS 7 上安装和配置 PHPList。对于那些不知道的人,PHPList 是一个开源通讯管理器,它允许我们添加和管理订阅者以及创建和发送电子邮件通讯。 它提供了一个用户友好的界面,您可以在其中管理时事通讯、订阅列表、时事通讯报告、通知等。 phpList 是用 PHP 编写的,并使用 MySQL 数据库来存储信息。

本文假设您至少具备 Linux 的基本知识,知道如何使用 shell,最重要的是,您将网站托管在自己的 VPS 上。 安装非常简单。 我将通过在 CentOS 7 服务器上的逐步安装 PHPList 向您展示。

在 CentOS 7 上安装 PHPList

步骤 1. 首先,确保所有软件包都是最新的。

yum - update

步骤 2. 安装 LAMP 服务器。

需要 CentOS 7 LAMP 服务器。 如果您没有安装 LAMP,您可以在此处按照我们的指南进行操作。 此外,安装 PHP 扩展以避免在首次访问 phpList 安装过程时出现已知的空白页问题:

yum install php-mbstring

步骤 3. 安装 PHPList。

下载 PHPList 的最新稳定版本,在撰写本文时它是 3.0.12 版本:

mkdir /var/www/html wget -O phplist-3.0.12.zip https://prdownloads.sourceforge.net/phplist/phplist-3.0.12.zip?download unzip phplist-3.0.12.zip mv phplist-3.0.12/public_html/lists/ /var/www/html/

我们将需要更改一些文件夹权限:

chown -R apache:apache lists/

步骤 4. 配置 MariaDB。

默认情况下,MariaDB 未加固。 您可以使用 mysql_secure_installation 脚本。 您应该仔细阅读下面的每个步骤,这些步骤将设置 root 密码、删除匿名用户、禁止远程 root 登录以及删除测试数据库和访问安全 MariaDB。

mysql_secure_installation

像这样配置它:

- Set root password? [Y/n] y - Remove anonymous users? [Y/n] y - Disallow root login remotely? [Y/n] y - Remove test database and access to it? [Y/n] y - Reload privilege tables now? [Y/n] y

接下来,我们需要登录 MariaDB 控制台并为 PHPList 创建一个数据库。 运行以下命令:

mysql -u root -p

这将提示您输入密码,因此输入您的 MariaDB 根密码并点击 Enter. 登录到数据库服务器后,您需要为 PHPList 安装创建一个数据库:

MariaDB > create database phplist; MariaDB > grant all privileges on phplist.* to [email protected] identified by 'your_password'; MariaDB > flush privileges; MariaDB > exit

现在编辑 PHPList 配置文件 config/config.php 并更新以下值。 将 TEST 变量的值更改为 0 以禁用测试模式(0=禁用测试模式,1=启用测试模式):

### nano lists/config/config.php $database_host = "localhost"; $database_name = "phplist"; $database_user = "phplistuser"; $database_password = 'your_password';  define ("TEST",0);

现在,我们可以重新启动 Apache 和 MariaDB 以便进行更改:

systemctl restart httpd.service systemctl restart mariadb.service

步骤 6. 访问 PHPList。

PHPList 默认在 HTTP 端口 80 上可用。 打开您喜欢的浏览器并导航到 https://yourdomain.com/lists/admin 或者 https://your-server-ip/lists/admin 并完成所需的步骤以完成安装。 如果您使用防火墙,请打开端口 80 以启用对控制面板的访问。

恭喜! 您已成功安装 PHPList。 感谢您使用本教程在 CentOS 7 系统上安装 PHPList。 如需更多帮助或有用信息,我们建议您查看 PHPList 官方网站.