GNU/Linux >> Linux の 問題 >  >> Ubuntu

Apacheと無料のLetsEncryptSSLを使用してUbuntu20.04にConcrete5CMSをインストールする方法

Concrete5は、インターネット上でコンテンツを公開するために使用されるオープンソースのコンテンツ管理システムです。 PHPで記述されており、MariaDBをデータベースバックエンドとして使用します。これは、Webブラウザーを介してページとコンテンツを作成するのに役立つ使いやすいビルダーを提供します。柔軟性があり、安全で、モバイル対応であり、Model-View-Controllerアーキテクチャに基づいています。 WYSIWYGコンテンツエディタ、メディアマネージャ、コンテンツのドラッグアンドドロップ、コンテキスト内編集など、豊富な機能セットを提供します。

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

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

まず、APTパッケージインデックスを最新バージョンに更新する必要があります。次のコマンドで更新できます:

apt-get update -y

APTインデックスが更新されたら、次のステップに進むことができます。

Apache、MariaDB、PHPをインストール

次に、Apache Webサーバー、MariaDBデータベースサーバー、PHP、およびその他のPHP拡張機能をサーバーにインストールする必要があります。次のコマンドを使用して、それらすべてをインストールできます。

apt-get install apache2 mariadb-server php libapache2-mod-php libapache2-mod-php php-common php-mbstring php-xmlrpc php-soap php-gd php-xml php-intl php-mysql php-cli php-ldap php-zip php-curl -y

すべてのパッケージがインストールされたら、php.iniファイルを編集して、必要な値を設定します。

nano /etc/php/7.4/apache2/php.ini

次の行を変更します:

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 64M
date.timezone = Asia/Kolkata

終了したらファイルを保存して閉じ、Apacheサービスを再起動して変更を適用します。

systemctl restart apache2

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

Concrete5データベースを作成する

次に、Concrete5のデータベースとユーザーを作成する必要があります。まず、次のコマンドを使用してMariaDBにログインします。

mysql

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

MariaDB [(none)]> CREATE DATABASE concrete5;
MariaDB [(none)]> CREATE USER 'concrete5user'@'localhost' IDENTIFIED BY 'password';

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

MariaDB [(none)]> GRANT ALL ON concrete5.* TO 'concrete5user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

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

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

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

Concrete5CMSをダウンロード

まず、Concrete5 CMS Webサイトにアクセスして、最新バージョンのConcrete5のURLをコピーし、次のコマンドを使用してダウンロードします。

wget --trust-server-names https://www.concrete5.org/download_file/-/view/115589/ -O concrete5.zip

ダウンロードが完了したら、次のコマンドを使用してダウンロードしたファイルを抽出します。

unzip concrete5.zip

次に、次のコマンドを使用して、抽出したディレクトリをApacheWebルートディレクトリに移動します。

mv concrete5-* /var/www/html/concrete5

次に、次のコマンドを使用して、concrete5ディレクトリに適切な権限と所有権を設定します。

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

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

Concrete5CMS用にApacheを構成する

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

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

次の行を追加します:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/concrete5/
     ServerName concrete5.example.com

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

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

ファイルを保存して閉じてから、次のコマンドでApache仮想ホストを有効にしてモジュールを書き換えます。

a2ensite concrete5.conf
a2enmod rewrite

次に、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 Sat 2021-05-15 15:00:03 UTC; 4s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 15566 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 15585 (apache2)
      Tasks: 6 (limit: 2353)
     Memory: 13.5M
     CGroup: /system.slice/apache2.service
             ??15585 /usr/sbin/apache2 -k start
             ??15586 /usr/sbin/apache2 -k start
             ??15587 /usr/sbin/apache2 -k start
             ??15588 /usr/sbin/apache2 -k start
             ??15589 /usr/sbin/apache2 -k start
             ??15590 /usr/sbin/apache2 -k start

May 15 15:00:03 ubuntu2004 systemd[1]: Starting The Apache HTTP Server...

この時点で、ApacheWebサーバーはConcrete5CMSをホストするように構成されています。これで、次のステップに進むことができます。

アクセスConcrete5CMSWebインターフェース

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

言語を選択して、矢印をクリックします ボタン。次のページが表示されます:

必要なライブラリがすべてインストールされていることを確認してから、インストールの続行をクリックします。 ボタンをクリックすると、次のページが表示されます:

ここで、管理者のユーザー名、パスワード、データベースのユーザー名、パスワード、データベース名を入力し、インストールをクリックします。 Concrete5 ボタンをクリックしてインストールを開始します。インストールが完了すると、次のページが表示されます。

次に、サイトの編集をクリックします ボタンをクリックすると、次のページにConcrete5ダッシュボードが表示されます。

SSLを暗号化してLet'sでコンクリート5を保護

次に、Let'sEncryptSSLを使用してWebサイトを保護することをお勧めします。まず、次のコマンドを使用してCertbotクライアントをインストールします。

apt-get install python3-certbot-apache -y

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

certbot --apache -d concrete5.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 concrete5.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/concrete5-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/concrete5-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/concrete5-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/concrete5.conf to ssl vhost in /etc/apache2/sites-available/concrete5-le-ssl.conf

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

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=concrete5.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/concrete5.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/concrete5.example.com/privkey.pem
   Your cert will expire on 2020-10-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

これで、URL https://concrete5.example.comを使用してConcrete5に安全にアクセスできます。 。

結論

上記のガイドでは、Apacheを使用してConcrete5CMSをインストールする方法とUbuntu20.04にSSLを暗号化する方法を学びました。これで、Concrete5CMSを使用してコンテンツをインターネット上で簡単に公開できます。ご不明な点がございましたら、お気軽にお問い合わせください。


Ubuntu
  1. Nginxを使用してNextcloudをインストールし、Ubuntu20.04LTSでSSLを暗号化する方法

  2. Nginxを使用してMagento2をインストールし、Ubuntu20.04LTSでSSLを暗号化する方法

  3. Nginxを使用してAutomadCMSをインストールし、Ubuntu18.04でSSLを暗号化できるようにします

  1. Nginxを使用してGravCMSをインストールし、Ubuntu18.04LTSに暗号化する方法

  2. ApacheでAutomadCMSをインストールし、Debian10で暗号化する方法

  3. ApacheでWonderCMSをインストールし、CentOS8でSSLを暗号化する方法

  1. Apache2でJoomlaをインストールし、Ubuntu20.04で暗号化する方法

  2. Webminをインストールし、Ubuntu20.04LTSでLetsEncryptSSLを使用して保護する方法

  3. Apacheを使用してVanillaフォーラムをインストールし、Ubuntu20.04LTSでSSLを暗号化する方法