分享最新优惠信息
购买主机更加划算

Alma Linux 8系统使用Apache安装Joomla以及Let’s Encrypt SSL简单教程

Joomla是一个免费的开源系统,也是最受欢迎的内容管理系统之一。它是用PHP编写的,用于在没有任何编程知识的情况下创建网站和博客。它提供免费和付费的插件和主题,可帮助您扩展网站功能。

此外,Joomla还提供了一个主动控制面板,用于从Web浏览器管理网站。Joomla提供了非常有用的功能,包括多语言支持、媒体管理器、搜索引擎优化、集成帮助系统、联系人管理等等。

在本文中,小编将简单介绍如何在Alma Linux 8系统上使用Apache安装Joomla CMS和Let’s Encrypt SSL的简单过程步骤。

Joomla

前提条件

  • 安装Alma Linux 8系统的服务器。
  • 服务器IP地址已经绑定域名。
  • 在服务器上配置了root密码。

安装LAMP服务器

Joomla在Web服务器上运行,用PHP编写,并使用MariaDB作为数据库后端。因此,需要在系统上安装LAMP服务器,可以使用以下命令安装它:

dnf install httpd @mariadb php php-curl php-xml php-zip php-mysqlnd php-intl php-gd php-json php-ldap php-mbstring php-opcache unzip curl wget -y

安装完成后,编辑PHP配置文件并更改默认设置:

nano /etc/php.ini

更改以下行:

memory_limit = 256M 
output_buffering = Off 
max_execution_time = 300 
date.timezone = UTC

保存并关闭文件,然后启动Apache服务并使其在系统重新启动时自动启动:

systemctl start httpd mariadb
systemctl enable httpd mariadb

配置MariaDB数据库

接下来需要为Joomla CMS创建一个数据库和用户。首先,使用以下命令连接到MariaDB:

mysql

登录后,使用以下命令创建数据库和用户:

MariaDB [(none)]> CREATE DATABASE joomla;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON joomla.* TO 'joomla'@'localhost' IDENTIFIED BY "securepassword";

然后重新加载权限以应用更改:

MariaDB [(none)]> FLUSH PRIVILEGES;

最后,使用以下命令退出MariaDB shell:

MariaDB [(none)]> EXIT;

完成之后,可以继续下一步。

下载Joomla CMS

在编写本教程时,最新的可用版本是Joomla 4.1.2,可以使用以下命令从他们的官方下载页面下载它:

wget https://downloads.joomla.org/cms/joomla4/4-1-2/Joomla_4-1-2-Stable-Full_Package.zip?format=zip -O joomla.zip

下载完成后,使用以下命令将下载的文件解压缩到Apache Web根目录:

unzip joomla.zip -d /var/www/html/joomla

接下来,更改Joomla目录的所有权和权限:

chown -R apache:apache /var/www/html/joomla/
chmod -R 775 /var/www/html/joomla/

完成后进行下一步设置。

为Joomla配置Apache

接下来需要为Joomla创建一个Apache虚拟主机配置文件,可以使用以下命令创建它:

nano /etc/httpd/conf.d/joomla.conf

添加以下代码(注意请将example.com替换成你自己的域名):

<VirtualHost *:80>
   ServerAdmin admin@example.com
   DocumentRoot "/var/www/html/joomla"
   ServerName joomla.example.com
   ErrorLog "/var/log/httpd/example.com-error_log"
   CustomLog "/var/log/httpd/example.com-access_log" combined

<Directory "/var/www/html/joomla">
   DirectoryIndex index.html index.php
   Options FollowSymLinks
   AllowOverride All
   Require all granted
</Directory>
</VirtualHost>

保存并关闭文件,然后重新启动Apache服务以应用配置更改:

systemctl restart httpd

现在可以使用以下命令检查Apache网络服务器的状态:

systemctl status httpd

这时候将获得以下输出:

? httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
  Drop-In: /usr/lib/systemd/system/httpd.service.d
           ??php-fpm.conf
   Active: active (running) since Fri 2022-04-15 08:52:59 UTC; 3s ago
     Docs: man:httpd.service(8)
 Main PID: 4749 (httpd)
   Status: "Started, listening on: port 80"
    Tasks: 213 (limit: 11412)
   Memory: 24.3M
   CGroup: /system.slice/httpd.service
           ??4749 /usr/sbin/httpd -DFOREGROUND
           ??4751 /usr/sbin/httpd -DFOREGROUND
           ??4752 /usr/sbin/httpd -DFOREGROUND
           ??4753 /usr/sbin/httpd -DFOREGROUND
           ??4754 /usr/sbin/httpd -DFOREGROUND

Apr 15 08:52:59 linux systemd[1]: httpd.service: Succeeded.
Apr 15 08:52:59 linux systemd[1]: Stopped The Apache HTTP Server.
Apr 15 08:52:59 linux systemd[1]: Starting The Apache HTTP Server...

完成Apache配置后,需要进行防火墙设置。

为Joomla配置防火墙

接下来,需要允许HTTP和HTTPS服务通过防火墙,可以使用以下命令允许它们:

firewall-cmd --add-service=http --zone=public --permanent 
firewall-cmd --add-service=https --zone=public --permanent

接下来,重新加载firewalld以应用更改:

firewall-cmd --reload

设置Joomla Web安装向导

现在,打开浏览器并访问URL http://joomla.example.com(替换成你自己的域名)访问Joomla 安装,这时候将出现以下界面。选择需要安装的语言(这里以安装英文为例),输入网站名称,具体如下图所示:

joomla安装语言

然后单击Setup Login Data,这时候应该看到管理员配置界面,如下图所示:

管理员配置页面

提供管理员用户名、密码,然后单击Setup Database Connection按钮,这时候应该看到以下界面:

数据库配置

接下来需要提供数据库名称、用户名、密码,然后单击Install Joomla按钮,安装Joomla之后应该会看到以下显示:

Joomla

单击Open Administrator按钮,这个时候应该会看到Joomla登录界面,如下图所示:

Joomla登录界面

输入管理员用户名、密码,然后单击Log in按钮,这时应该会进入到Joomla后台管理面板,这样Joomla CMS程序的安装过程也就完成了。后面自己就可以在控制面板中进行各项设置。

Joomla后台管理面板

 

安装Let’s Encrypt SSL证书保护Joomla

接下来需要安装Certbot客户端来为网站安装Let’s Encrypt SSL,可以使用以下命令安装它:

dnf install epel-release -y
nf install certbot python3-certbot-apache

接下来,使用以下命令为Lets域名获取并安装SSL证书(需要换成你自己的域名):

certbot --apache -d joomla.example.com

这时候将被要求提供电子邮件地址并接受服务条款,具体设置如下:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): hitjethva@gmail.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: Y
Account registered.
Requesting a certificate for joomla.example.com
Performing the following challenges:
http-01 challenge for joomla.example.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/httpd/conf.d/joomla.conf
Redirecting all traffic on port 80 to ssl in /etc/httpd/conf.d/joomla.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://joomla.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Subscribe to the EFF mailing list (email: hitjethva@gmail.com).


IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/joomla.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/joomla.example.com/privkey.pem
   Your certificate will expire on 2022-07-09. To obtain a new or
   tweaked version of this certificate in the future, simply run
   certbot again with the "certonly" option. To non-interactively
   renew *all* of your certificates, run "certbot renew"
 - 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

总结

通过以上设置之后,现在已经成功地在Alma Linux 8系统上安装了带有Apache的Joomla CMS以及Let’s Encrypt SSL证书,怎么样是不是很简单,那就赶快去去试试吧。

总之,使用出色的Joomla CMS程序,现在无需任何编程或编码知识即可构建自己的网站,可以随心所欲的发表自己的文章,可以说是非常的简单方便。

未经允许不得转载:惠主机 » Alma Linux 8系统使用Apache安装Joomla以及Let’s Encrypt SSL简单教程

相关文章