如何在 Ubuntu 22.04 LTS 上安装 ProcessWire

Linux命令 Edge插件网 2年前 (2023-03-27) 368次浏览 已收录 0个评论

ProcessWire是一个免费的开源内容管理系统(CMS),以其灵活性,可扩展性和安全性而闻名。它旨在使开发人员能够轻松构建和管理任何复杂的网站,从小型个人博客到大型企业网站。它以其简单性、灵活性和可扩展性而闻名,使其成为 Web 开发人员和设计师的热门选择。

如何在 Ubuntu 22.04 LTS 上安装 ProcessWire

在 Ubuntu 22.04 LTS Jammy Jellyfish 上安装 ProcessWire

第 1 步。首先,通过在终端中运行以下命令,确保所有系统软件包都是最新的。apt

<span class="pln">sudo apt update
sudo apt upgrade
sudo apt install wget apt</span><span class="pun">-</span><span class="pln">transport</span><span class="pun">-</span><span class="pln">https gnupg2</span>

第 2 步。在 Ubuntu 上安装 LAMP 堆栈。

在开始本教程之前,必须在服务器上安装 LAMP 服务器。如果您没有安装 LAMP 堆栈,您可以按照我们的指南进行操作。

第 3 步。在 Ubuntu 22.04 上安装 ProcessWire

默认情况下,ProcessWire 在 Ubuntu 22.04 基本存储库上不可用。现在运行以下命令,通过运行以下命令下载最新版本的ProcessWire:

<span class="pln">wget https</span><span class="pun">:</span><span class="com">//github.com/processwire/processwire/archive/master.zip</span>

通过运行以下命令提取下载的 zip 文件:

<span class="pln">unzip master</span><span class="pun">.</span><span class="pln">zip</span>

接下来,将解压缩的目录移动到 Apache Web 根目录:

<span class="pln">mv processwire</span><span class="pun">-</span><span class="pln">master</span><span class="str">/ /</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">processwire</span>

之后,更改ProcessWire目录的所有权和权限:

<span class="pln">chown www</span><span class="pun">-</span><span class="pln">data</span><span class="pun">:</span><span class="pln">www</span><span class="pun">-</span><span class="pln">data </span><span class="pun">-</span><span class="pln">R </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">processwire</span><span class="pun">/</span><span class="pln">
chmod </span><span class="pun">-</span><span class="pln">R </span><span class="lit">755</span> <span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">processwire</span><span class="pun">/</span>

第 4 步。配置 MariaDB。

默认情况下,MariaDB 未强化。您可以使用脚本保护 MariaDB。您应该仔细阅读并在每个步骤下方仔细阅读,这将设置root密码,删除匿名用户,禁止远程root登录,并删除测试数据库和对安全MariaDB的访问权限:mysql_secure_installation

<span class="pln">mysql_secure_installation</span>

像这样配置它:

<span class="pun">-</span> <span class="typ">Set</span><span class="pln"> root password</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y
</span><span class="pun">-</span> <span class="typ">Remove</span><span class="pln"> anonymous users</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y
</span><span class="pun">-</span> <span class="typ">Disallow</span><span class="pln"> root login remotely</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y
</span><span class="pun">-</span> <span class="typ">Remove</span><span class="pln"> test database </span><span class="kwd">and</span><span class="pln"> access to it</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y
</span><span class="pun">-</span> <span class="typ">Reload</span><span class="pln"> privilege tables now</span><span class="pun">?</span> <span class="pun">[</span><span class="pln">Y</span><span class="pun">/</span><span class="pln">n</span><span class="pun">]</span><span class="pln"> y</span>

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

<span class="pln">mysql </span><span class="pun">-</span><span class="pln">u root </span><span class="pun">-</span><span class="pln">p</span>

这将提示您输入密码,因此请输入您的MariaDB root密码并按Enter键。登录到数据库服务器后,您需要为ProcessWire安装创建一个数据库:

<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> CREATE USER </span><span class="str">'processuser'</span><span class="pun">@</span><span class="str">'localhost'</span><span class="pln"> IDENTIFIED BY </span><span class="str">'your-strong-password'</span><span class="pun">;</span>
<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> CREATE DATABASE processdb</span><span class="pun">;</span>
<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> GRANT ALL PRIVILEGES ON processdb</span><span class="pun">.*</span><span class="pln"> TO </span><span class="str">'processuser'</span><span class="pun">@</span><span class="str">'localhost'</span><span class="pun">;</span>
<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> FLUSH PRIVILEGES</span><span class="pun">;</span>
<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span> <span class="typ">Exit</span><span class="pun">;</span>

第5步。为 ProcessWire 配置 Apache 。

首先,为 ProcessWire 创建一个新的虚拟主机配置文件:

<span class="pln">nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">apache2</span><span class="pun">/</span><span class="pln">sites</span><span class="pun">-</span><span class="pln">available</span><span class="pun">/</span><span class="pln">processwire</span><span class="pun">.</span><span class="pln">conf</span>

将以下行添加到文件中:

<span class="tag"><VirtualHost</span><span class="pln"> *:80</span><span class="tag">></span><span class="pln">
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/processwire/
ServerName your-domain.com
</span><span class="tag"><Directory</span> <span class="pun">/</span><span class="atn">var</span><span class="pun">/</span><span class="atn">www</span><span class="pun">/</span><span class="atn">html</span><span class="pun">/</span><span class="atn">processwire</span><span class="tag">/></span><span class="pln">
Options FollowSymLinks
AllowOverride All
Require all granted
</span><span class="tag"></Directory></span><span class="pln">
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</span><span class="tag"></VirtualHost></span>

保存并关闭文件,然后重新启动 Apache Web 服务器,以便进行更改:

<span class="pln">sudo a2ensite processwire</span><span class="pun">.</span><span class="pln">conf
sudo a2enmod rewrite
sudo systemctl restart apache2</span>

第 6 步。使用Let’s Encrypt SSL保护UVdesk。

首先,使用以下命令安装 Certbot 客户端:

<span class="pln">sudo apt install certbot python3</span><span class="pun">-</span><span class="pln">certbot</span><span class="pun">-</span><span class="pln">apache2</span>

接下来,按照以下步骤使用Let’s Encrypt获取SSL证书:

<span class="pln">certbot </span><span class="pun">--</span><span class="pln">apache </span><span class="pun">-</span><span class="pln">d your</span><span class="pun">-</span><span class="pln">domain</span><span class="pun">.</span><span class="pln">com</span>

让我们加密证书的有效期为 90 天,强烈建议在证书过期之前续订证书。您可以通过运行以下命令来测试证书的自动续订:

<span class="pln">sudo certbot renew </span><span class="pun">--</span><span class="pln">dry</span><span class="pun">-</span><span class="pln">run</span>

步骤 7.配置防火墙。

现在我们使用Apache设置了一个简单防火墙(UFW),以允许在HTTP和HTTPS的默认Web端口上进行公共访问:

<span class="pln">sudo ufw allow </span><span class="typ">OpenSSH</span><span class="pln">
sudo ufw allow </span><span class="str">'Apache Full'</span><span class="pln">
sudo ufw enable</span>

第8步。访问ProcessWire Web界面。

成功安装后,现在打开您的 Web 浏览器并使用 URL 访问 ProcessWire Web UI。您将被重定向到以下页面:https://your-domain.com

如何在 Ubuntu 22.04 LTS 上安装 ProcessWire

感谢您使用本教程在 Ubuntu 22.04 LTS Jammy Jellyfish 系统上安装 ProcessWire CMS。有关其他帮助或有用信息,我们建议您查看ProcessWire网站


Edge插件网 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:如何在 Ubuntu 22.04 LTS 上安装 ProcessWire
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址