ウェブサイト検索

Alma Linux 8にApacheと無料のLet's Encrypt SSLを使用してJoomlaをインストールする方法


Alma Linux 8にApacheと無料のLet's Encrypt SSLを使用してJoomlaをインストールする方法

このチュートリアルはこれらのOSバージョンのために存在します

  • AlmaLinux 9
  • AlmaLinux 8

このページで

  1. 前提条件
  2. LAMPサーバーをインストールする
  3. MariaDBデータベースを設定する
  4. Joomla CMSをダウンロード
  5. JoomlaのためにApacheを設定する
  6. Joomlaのファイアウォールを設定する
  7. Joomlaウェブインストールウィザードにアクセスする
  8. Let's Encrypt SSLでJoomla CMSを安全にする
  9. 結論

Joomlaは無料でオープンソースの、最も人気のあるコンテンツ管理システムの1つです。PHPで書かれており、プログラミングの知識がなくてもウェブサイトやブログを作成するために使用されます。ウェブサイトの機能を拡張するのに役立つ無料および有料のプラグインやテーマを提供しています。また、ウェブブラウザからウェブサイトを管理するための使いやすいコントロールパネルも提供しています。Joomlaは多言語サポート、メディアマネージャー、SEO、統合ヘルプシステム、連絡先管理など、非常に便利な機能を提供しています。

このチュートリアルでは、Alma Linux 8にApacheとLet's Encrypt SSLを使用してJoomla CMSをインストールする方法を学びます。

前提条件

  • Alma Linux 8を実行しているサーバー。
  • あなたのサーバーIPにポイントされた有効なドメイン名。
  • サーバーにはルートパスワードが設定されています。

LAMPサーバーをインストールする

Joomlaはウェブサーバー上で動作し、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シェルから退出します:

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

次のコードを追加してください:

<VirtualHost *:80>
   ServerAdmin [email 
   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ウェブインストールウィザードにアクセスする

さて、ウェブブラウザーを開いて、URL http://joomla.example.com を使用してJoomlaのインストールにアクセスしてください。次の画面にリダイレクトされます:

言語を選択し、ウェブサイト名を入力してから、ログインデータのセットアップをクリックしてください。管理設定画面が表示されるはずです:

管理者のユーザー名とパスワードを入力し、データベース接続の設定をクリックしてください。次の画面が表示されるはずです:

データベース名、ユーザー名、パスワードを入力し、 Joomlaをインストールボタンをクリックしてください。Joomlaがインストールされると、次の画面が表示されるはずです:

管理者を開くボタンをクリックします。Joomlaのログイン画面が表示されるはずです。

管理者のユーザー名とパスワードを入力し、ログインボタンをクリックしてください。次の画面にJoomlaのダッシュボードが表示されるはずです:

Let's Encrypt SSLでJoomla CMSを安全にする

次に、ウェブサイトのためにLet's Encrypt SSLをインストールするために、Certbotクライアントをインストールする必要があります。次のコマンドでインストールできます:

dnf install epel-release -y
dnf 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): [email 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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: [email ).


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とLet's Encrypt SSLを使ってJoomla CMSを正常にインストールしました。素晴らしいJoomla CMSを使って、プログラミングやコーディングの知識がなくても、自分のウェブサイトを構築することができます。何か質問があれば、遠慮なくお尋ねください。

関連記事: