joomla 是一个免费的开源内容管理系统,用于在网站上发布 web 内容。它基于 php 构建,并将其数据存储在后端的基于 sql 的数据库引擎上,例如 mysql/mariadb。
在 ubuntu 22.04 lts jammy jellyfish 上
apt
步骤 1. 首先,通过在终端中运行以下命令,确保所有系统包都是最新的。
sudo apt update
sudo apt upgrade
步骤 2. 在 ubuntu 22.04 上安装 lamp 堆栈。
在开始本教程之前,必须在您的服务器上安装 lamp 服务器。如果您没有安装 lamp stack,您可以在此处按照我们的指南进行操作。
步骤 3. 在 ubuntu 22.04 上安装 joomla。
默认情况下,joomla 在 ubuntu 22.04 基础存储库中不可用。现在运行以下命令将最新的稳定版 joomla 下载到您的 ubuntu 系统:
wget https://downloads.joomla.org/cms/joomla4/4-1-4/joomla_4-1-4-stable-full_package.zip
下载完成后。我们需要把它解压到目录:/var/www/html/
sudo unzip joomla_4-1-4-stable-full_package.zip -d /var/www/html/joomla
我们将需要更改一些文件夹权限:
sudo chown -r www-data:www-data /var/www/html/joomla/
步骤 4. 为 joomla 配置 mariadb。
默认情况下,mariadb 未加固。mysql_secure_installation
您可以使用脚本保护 mariadb 。您应该仔细阅读下面的每个步骤,这些步骤将设置 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 控制台并为 joomla 创建一个数据库。运行以下命令:
mysql -u root -p
这将提示您输入密码,因此请输入您的 mariadb 根密码并按 enter。登录到数据库服务器后,您需要为 joomla 安装创建一个数据库:
mariadb [(none)]> create database joomla_db; mariadb [(none)]> create user 'joomla_user'@'localhost' identified by 'your-strong-password'; mariadb [(none)]> grant all on joomla_db.* to 'joomla_user'@'localhost'; mariadb [(none)]> flush privileges; mariadb [(none)]> exit;
步骤 5. 为 joomla 配置 apache web 服务器。
现在我们为 joomla 创建一个 apache 虚拟主机:
nano /etc/apache2/sites-available/joomla.conf
添加以下文件:
*:80>
serveradmin admin@your-domain.com
documentroot /var/www/html/joomla/
servername your-domain.com
serveralias www.your-domain.com
errorlog ${apache_log_dir}/error.log
customlog ${apache_log_dir}/access.log combined
/var/www/html/joomla/>
options followsymlinks
allowoverride all
require all granted
保存并关闭文件,然后重新启动 apache 网络服务器以进行更改:
sudo a2ensite joomla.conf sudo a2enmod rewrite sudo a2enmod ssl rewrite sudo systemctl restart apache2
第 6 步:使用 let’s encrypt 保护 joomla。
首先,您需要安装 certbot 以使用 let’s encrypt 获取 ssl 证书:
sudo apt install certbot python3-certbot-apache
接下来,按照以下步骤使用 let’s encrypt 获取您的 ssl 证书:
sudo certbot --apache
您将需要按照交互式提示安装证书。由于我有两个域,我将为这两个域安装 ssl 证书:
saving debug log to /var/log/letsencrypt/letsencrypt.log enter email address (used for urgent renewal and security notices) (enter 'c' to cancel): admin@your-domain.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - please read the terms of service at https://letsencrypt.org/documents/le-sa-v1.2-november-15-2017.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 foundation, 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: n account registered. which names would you like to activate https for? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: your-domain.com 2: www.your-domain.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (enter 'c' to cancel): 1,2 requesting a certificate for your-domain.com and www.your-domain.com successfully received certificate. certificate is saved at: /etc/letsencrypt/live/your-domain.com/fullchain.pem key is saved at: /etc/letsencrypt/live/your-domain.com/privkey.pem this certificate expires on 2022-09-16. 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 domain.com to /etc/apache2/sites-available/www.your-domain.com-le-ssl.conf successfully deployed certificate for www.domain.com to /etc/apache2/sites-available/www.your-domain.com-le-ssl.conf congratulations! you have successfully enabled https on https://domain.com and https://www.your-domain.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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
步骤 7. 设置自动续订 ssl。
let’s encrypt 证书的有效期为 90 天,强烈建议在证书到期前更新证书。您可以通过运行以下命令来测试证书的自动续订:
sudo certbot renew --dry-run
步骤 8. 配置防火墙。
现在,我们使用 apache 设置了一个简单防火墙 (ufw),以允许对 http 和 https 的默认 web 端口进行公共访问:
sudo ufw allow openssh sudo ufw allow 'apache full' sudo ufw enable
步骤 9. 访问 joomla web 界面。
成功安装后,打开您的网络浏览器并使用 url 访问 joomla 安装向导。您将被重定向到以下页面:https://your-domain.com
感谢您使用本教程在 ubuntu 22.04 lts jammy jellyfish 系统上安装带有 lamp 的 joomla 4。如需其他帮助或有用信息,我们建议您查看。
原创文章,作者:校长,如若转载,请注明出处:https://www.yundongfang.com/yun224336.html