もっと詳しく

Joomlaは、無料のオープンソースで受賞歴のあるコンテンツ管理システムであり、WebサイトやオンラインWebアプリケーションを構築できます。 これはPHPで記述されており、データベースのバックエンドとしてMySQLを使用します。 Joomlaは、ユーザーがコンテンツを効率的に整理および管理するのに役立ついくつかの優れた機能を提供します。 それは拡張可能で、使いやすく、検索エンジンにやさしく、中央の場所からあなたのウェブサイトを管理するためのユーザーフレンドリーなウェブインターフェースを提供します。

この投稿では、Apacheを使用してJoomlaCMSをインストールする方法とUbuntu22.04にSSLを暗号化する方法を紹介します。

前提条件

  • Ubuntu22.04を実行しているサーバー。
  • サーバーIPを指す有効なドメイン名。
  • ルートパスワードはサーバーで構成されます。

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

まず、次のコマンドを使用して、Apache Webサーバー、MySQLデータベースサーバー、および他の拡張機能を備えた最新バージョンのPHPをインストールします。

apt install apache2 mysql-server php8.1 libapache2-mod-php8.1 php8.1-dev php8.1-bcmath php8.1-intl php8.1-soap php8.1-zip php8.1-curl php8.1-mbstring php8.1-mysql php8.1-gd php8.1-xml unzip -y

すべてのパッケージがインストールされたら、次のコマンドを使用してPHPのバージョンを確認します。

php -v

次の出力が表示されます。

PHP 8.1.2 (cli) (built: Apr  7 2022 17:46:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

終了したら、次のステップに進むことができます。

Joomla用のMySQLデータベースを作成する

次に、JoomlaがWebコンテンツを保存するためのデータベースとユーザーを作成する必要があります。 まず、次のコマンドを使用してMySQLに接続します。

mysql

接続したら、次のコマンドを使用してデータベースとユーザーを作成します。

mysql> CREATE DATABASE joomladb;
mysql> CREATE USER 'joomlauser'@'localhost' IDENTIFIED BY 'securepassword';

次に、次のコマンドを使用して、Joomlaデータベースにすべての特権を付与します。

mysql> GRANT ALL ON joomladb.* TO 'joomlauser'@'localhost';

次に、特権テーブルをフラッシュし、次のコマンドを使用してMySQLを終了します。

mysql> FLUSH PRIVILEGES;
mysql> EXIT;

終了したら、次のステップに進むことができます。

Joomlaをダウンロード

このチュートリアルを書いている時点では、Joomlaの最新バージョンは4.2.1です。 次のコマンドを使用して、公式Webサイトからダウンロードできます。

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

ダウンロードが完了したら、次のコマンドを使用して、ダウンロードしたファイルをApacheWebルートディレクトリに解凍します。

unzip Joomla_4-1-2-Stable-Full_Package.zip -d /var/www/html/joomla

次に、次のコマンドを使用してJoomlaの所有権と権限を変更します。

chown -R www-data:www-data /var/www/html/joomla/
chmod -R 755 /var/www/html/joomla/

終了したら、次のステップに進むことができます。

Joomla用のApache仮想ホストを作成する

次に、Joomla用のApache仮想ホスト構成ファイルを作成する必要があります。 次のコマンドで作成できます。

nano /etc/apache2/sites-available/joomla.conf

次の行を追加します。

<VirtualHost *:80>

ServerAdmin [email protected]

ServerName joomla.example.com
DocumentRoot /var/www/html/joomla

<Directory /var/www/html/joomla/>
        Options FollowSymlinks
        AllowOverride All
        Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/example.com_error.log
CustomLog ${APACHE_LOG_DIR}/example.com_access.log combined

</VirtualHost>

ファイルを保存して閉じてから、次のコマンドでJoomla仮想ホストをアクティブ化します。

a2ensite joomla.conf

次に、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-04-29 07:59:59 UTC; 4s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 16393 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 16398 (apache2)
      Tasks: 6 (limit: 4630)
     Memory: 13.8M
        CPU: 129ms
     CGroup: /system.slice/apache2.service
             ??16398 /usr/sbin/apache2 -k start
             ??16399 /usr/sbin/apache2 -k start
             ??16400 /usr/sbin/apache2 -k start
             ??16401 /usr/sbin/apache2 -k start
             ??16402 /usr/sbin/apache2 -k start
             ??16403 /usr/sbin/apache2 -k start

Apr 29 07:59:59 ubuntu systemd[1]: Starting The Apache HTTP Server...

完了したら、次のステップに進むことができます。

JoomlaWebインストールにアクセスする

次に、Webブラウザーを開き、URLを使用してJoomlaWebインストールにアクセスします。 http://joomla.example.com。 次のページにリダイレクトされます。

言語を選択し、サイト名を定義して、をクリックします 設定 ログイン データ。 次のページが表示されます。

Joomlaにログインします

本名、ユーザー名、パスワード、メールアドレスを入力して、 設定 データベース 繋がり。 次のページが表示されます。

データベース構成

データベース名、データベースユーザー名、ホスト、パスワードを入力し、をクリックします。 Joomlaをインストールする ボタン。 Joomlaをインストールすると、次のページが表示されます。

Joomlaのインストールは正常に終了しました

クリックしてください 管理者を開く。 Joomlaのログインページが表示されます。

管理者としてログイン

管理者のユーザー名とパスワードを入力し、[ログイン]ボタンをクリックします。 次のページにJoomlaダッシュボードが表示されます。

Joomlaダッシュボード

Let’sEncryptSSLでJoomlaを保護する

Let’sEncryptSSLを使用してWebサイトを保護することは常に良い考えです。 SSLをインストールして管理するには、Certbotクライアントをインストールする必要があります。 次のコマンドでインストールできます。

apt-get install python3-certbot-apache -y

Certbotをインストールしたら、次のコマンドを実行して、Let’sEncryptSSLでWebサイトを保護します。

certbot --apache -d joomla.example.com

以下に示すように、メールアドレスを提供し、利用規約に同意するよう求められます。

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
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.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing 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
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for joomla.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/joomla-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/joomla-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/joomla-le-ssl.conf

次に、以下に示すように、HTTPトラフィックをHTTPSにリダイレクトするかどうかを選択します。

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

2と入力し、Enterキーを押して、WebサイトにLet’sEncryptSSLをインストールします。

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/joomla.conf to ssl vhost in /etc/apache2/sites-available/joomla-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://joomla.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=joomla.example.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 cert will expire on 2023-01-23. 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

これで、URLhttps://joomla.example.comを使用してWebサイトに安全にアクセスできます。

結論

おめでとう! これで、Ubuntu22.04にApacheとLet’sEncryptSSLを使用してJoomlaが正常にインストールされました。 これで、Joomlaプラットフォームを使用してWebサイトを簡単に作成およびホストできます。 ご不明な点がございましたら、お気軽にお問い合わせください。

The post ApacheでJoomlaをインストールし、Ubuntu22.04でSSLを暗号化する方法 appeared first on Gamingsym Japan.