如何在 Debian 上安装 phpBB 论坛
如何在 Debian 上安装 phpBB 论坛
phpBB 是免费的开源公告板软件,可让您与一群人保持联系。 它可以为您的整个网站提供支持,并为人们提供聚集和交易所的空间。 它提供了一个基于网络的界面,人们可以在其中发布主题,其他人可以回复这些主题。 使用 phpBB,您可以分配角色、创建角色扮演列表、启用特殊权限、向社区发送新闻通讯以及创建自定义内容。 如果您想创建论坛风格的讨论板,那么 phpBB 是一个很棒的工具。
这篇文章将向您展示如何在 Debian 11 上使用 Apache 安装 phpBB 和 Let’s Encrypt SSL。
先决条件
- 您的系统上安装了 Debian 11 服务器。
- 有效域名指向您的服务器 IP。
- 服务器上配置了 root 密码。
安装 LAMP 服务器
phpBB 用 PHP 编写,并使用 MariaDB 作为数据库后端。 因此,您需要在服务器上安装 Apache Web 服务器、MariaDB 数据库服务器、PHP 和其他软件包。 您可以通过运行以下命令来安装所有这些:
apt install apache2 mariadb-server php libapache2-mod-php php-gd php-curl openssl php-imagick php-intl php-json php-ldap php-common php-mbstring php-mysql php-imap php-sqlite3 php-net-ftp php-zip unzip php-pgsql php-ssh2 php-xml wget unzip -y
安装所有软件包后,您可以使用以下命令启动并启用 Apache 服务:
systemctl start apache2
systemctl enable apache2
配置 MariaDB 数据库
接下来,您需要为 phpBB 创建数据库和用户。 首先,使用以下命令登录 MariaDB shell:
mysql
登录后,使用以下命令创建数据库和用户:
MariaDB [(none)]> CREATE DATABASE phpbbdb;
MariaDB [(none)]> GRANT ALL ON phpbbdb.* to 'phpbbuser'@'localhost' IDENTIFIED BY 'password';
接下来,使用以下命令刷新权限并退出 MariaDB:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
完成后,您可以继续下一步。
安装 phpBB Debian 11
首先,访问phpBB官方网站并使用以下命令下载最新版本的phpBB。
wget https://download.phpbb.com/pub/release/3.3/3.3.9/phpBB-3.3.9.zip
下载成功后,使用以下命令解压下载的文件:
unzip phpBB-3.3.9.zip
接下来,将解压的目录移动到 Apache Web 根目录:
mv phpBB3 /var/www/html/phpbb
接下来,更改 phpbb 目录的所有权和权限:
chown -R www-data:www-data /var/www/html/phpbb
chmod -R 775 /var/www/html/phpbb
完成后,您可以继续下一步。
为 phpBB 创建 Apache 虚拟主机
接下来,您需要创建一个 Apache 虚拟主机配置文件来托管 phpBB。 您可以使用以下命令创建它:
nano /etc/apache2/sites-available/phpbb.conf
添加以下行:
ServerAdmin [email protected] DocumentRoot /var/www/html/phpbb ServerName phpbb3.example.com Options FollowSymlinks AllowOverride All Require all granted ErrorLog ${APACHE_LOG_DIR}/phpbb_error.log CustomLog ${APACHE_LOG_DIR}/phpbb_access.log combined
完成后保存并关闭文件。 然后,使用以下命令启用 Apache 虚拟主机和重写模块:
a2ensite phpbb
a2enmod rewrite
最后,重新启动 Apache 服务以应用更改:
systemctl restart apache2
您还可以使用以下命令检查 Apache 服务的状态:
systemctl status apache2
您将得到以下输出:
? apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2022-12-30 04:44:52 UTC; 5s ago Docs: https://httpd.apache.org/docs/2.4/ Process: 17472 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Main PID: 17476 (apache2) Tasks: 6 (limit: 4675) Memory: 16.4M CPU: 108ms CGroup: /system.slice/apache2.service ??17476 /usr/sbin/apache2 -k start ??17477 /usr/sbin/apache2 -k start ??17478 /usr/sbin/apache2 -k start ??17479 /usr/sbin/apache2 -k start ??17480 /usr/sbin/apache2 -k start ??17481 /usr/sbin/apache2 -k start Dec 30 04:44:52 debian11 systemd[1]: Starting The Apache HTTP Server...
至此,phpBB 已与 Apache Web 服务器一起安装。 您现在可以继续访问 phpBB Web UI。
访问 phpBB 网页界面
现在,打开 Web 浏览器并使用 URL http://phpbb3.example.com 访问 phpBB Web UI。 您应该看到以下页面:
单击“安装”选项卡。 您应该看到以下页面。
现在,单击“安装”按钮开始安装。 您应该看到以下页面:
设置您的管理员用户名、密码,然后单击“提交”按钮。 您应该看到以下页面:
定义您的数据库主机、端口、数据库名称、用户名、密码,然后单击“提交”按钮。 您应该看到以下页面:
定义您的协议、网站域名、端口、路径,然后单击“提交”按钮。 您应该看到以下页面:
输入您的 SMTP 详细信息,然后单击“提交”按钮。 您应该看到以下页面:
选择您的语言、开发板名称、开发板描述,然后单击“提交”按钮。 您应该看到以下页面:
单击带我前往 ACP 按钮。 您应该在以下页面上看到 phpBB 控制面板:
在 phpBB 论坛上启用 SSL
要在您的网站上启用 SSL,您需要在服务器上安装 Certbot 客户端。
首先,使用以下命令安装 Snap 包管理器:
apt install snapd
接下来,将 Snap 包更新到最新版本:
snap install core
snap refresh core
接下来,使用以下命令安装 certbot 包:
snap install --classic certbot
接下来,为 Certbot 二进制文件创建到系统位置的符号链接:
ln -s /snap/bin/certbot /usr/bin/certbot
接下来,运行以下命令下载并安装 Let’s Encrypt SSL 证书:
certbot --apache -d phpbb.example.com
您将被要求提供您的电子邮件并接受服务条款,如下所示:
Saving debug log to /var/log/letsencrypt/letsencrypt.log Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): [email protected] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf. You must agree in order to register with the ACME server. Do you agree? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing, once your first certificate is successfully issued, to share your email address with the Electronic Frontier基金, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y
键入 Y 并按 Enter 键来下载并安装您的域的 SSL 证书:
Account registered. Requesting a certificate for phpbb.example.com Successfully received certificate. Certificate is saved at: /etc/letsencrypt/live/phpbb.example.com/fullchain.pem Key is saved at: /etc/letsencrypt/live/phpbb.example.com/privkey.pem This certificate expires on 2023-03-29. These files will be updated when the certificate renews. Certbot has set up a scheduled task to automatically renew this certificate in the background. Deploying certificate Successfully deployed certificate for phpbb.example.com to /etc/apache2/sites-available/phpbb.conf Congratulations! You have successfully enabled HTTPS on https://phpbb.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If you like Certbot, please consider supporting our work by: * Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate * Donating to EFF: https://eff.org/donate-le - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
现在,您可以使用 URL https://phpbb.example.com 安全地访问您的网站。
结论
在这篇文章中,我们解释了如何在 Debian Linux 上使用 Apache 安装 phpBB 和 Let’s Encrypt SSL。 您现在可以使用 phpBB 在您的组织中创建论坛式讨论板。 如果您有任何疑问,请随时问我。