ウェブサイト検索

Debian 11に無料のLet's Encrypt SSLを使ってConcrete5 CMSをインストールする方法


Debian 11に無料のLet's Encrypt SSLを使ってConcrete5 CMSをインストールする方法

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

  • Debian 11 (Bullseye)
  • Debian 9(ストレッチ)

このページで

  1. 前提条件
  2. Apache、MariaDB、およびPHPをインストールする
  3. Concrete5のデータベースを作成する
  4. Concrete5 CMSをインストールする
  5. Apacheのバーチャルホスト構成ファイルを作成する
  6. コンクリート5 CMSにアクセスする
  7. Let's Encrypt SSLを使用してConcrete5を安全にする
  8. 結論

Concrete5は、インターネットコンテンツを公開するための無料のオープンソースコンテンツ管理システムです。これは、コンピュータスキルがほとんどない初心者のユーザーのために設計されており、ウェブブラウザから直接ウェブサイトを編集できるようにしています。シンプルで軽量、使いやすく、PHPで書かれています。直感的なウェブインターフェース、SEOフレンドリー、ソーシャルメディア、モバイル最適化、拡張可能、統合レポートなど、役立つ機能が豊富に揃っています。

この投稿では、Debian 11にApacheとLet's Encrypt SSLを使ってConcrete5 CMSをインストールする方法を示します。

前提条件

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

Apache、MariaDB、およびPHPをインストールする

まず、Apacheウェブサーバー、MariaDBデータベースサーバー、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ファイルを編集して、いくつかのPHP設定を調整します:

nano /etc/php/7.3/apache2/php.ini

次の行を変更してください:

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 64M
date.timezone = UTC

完了したらファイルを保存して閉じ、変更を適用するためにApacheサービスを再起動してください:

systemctl restart apache2

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

Concrete5は、データベースバックエンドとしてMariaDBまたはMySQLを使用します。したがって、Concrete5用にデータベースとユーザーを作成する必要があります。

まず、以下のコマンドでMariaDBにログインしてください。

mysql

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

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

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

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

次に、次のコマンドを使用して権限をフラッシュし、MariaDBコンソールから退出します:

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

Concrete5 CMSをインストールする

次に、Concrete5 CMSのダウンロードページに移動し、最新のConcrete5のURLをコピーして、以下のコマンドを実行してシステムにダウンロードします:

wget https://www.concretecms.org/application/files/3916/3649/1545/concrete-cms-9.0.1.zip

ダウンロードが完了したら、以下のコマンドを使用してダウンロードしたファイルを解凍してください:

unzip concrete-cms-9.0.1.zip

次に、抽出したディレクトリをApacheのWebルートディレクトリに移動します。

mv concrete-cms-9.0.1 /var/www/html/concrete5

次に、次のコマンドを使用して、Concrete5ディレクトリの所有権とアクセス権を変更します:

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

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

Apacheのバーチャルホスト構成ファイルを作成する

次に、Concrete5 CMSのためにApacheの仮想ホスト設定ファイルを作成する必要があります。以下のコマンドを使用して作成できます。

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

次の行を追加してください:

<VirtualHost *:80>
     ServerAdmin [email 
     DocumentRoot /var/www/html/concrete5
     ServerName concrete5.yourdomain.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 Fri 2021-12-10 14:29:49 UTC; 5s ago
     Docs: https://httpd.apache.org/docs/2.4/
  Process: 16050 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 16054 (apache2)
    Tasks: 6 (limit: 4701)
   Memory: 15.4M
   CGroup: /system.slice/apache2.service
           ??16054 /usr/sbin/apache2 -k start
           ??16055 /usr/sbin/apache2 -k start
           ??16056 /usr/sbin/apache2 -k start
           ??16057 /usr/sbin/apache2 -k start
           ??16058 /usr/sbin/apache2 -k start
           ??16059 /usr/sbin/apache2 -k start

Dec 10 14:29:49 debian11 systemd[1]: Starting The Apache HTTP Server...

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

コンクリート5 CMSにアクセスする

さて、ウェブブラウザを開いて、URL http://concrete5.yourdomain.com を使ってConcrete5 CMSにアクセスしてください。次のページにリダイレクトされます:

言語を選択し、> ボタンをクリックしてください。次のページが表示されるはずです。

すべてのPHP拡張がインストールされていることを確認し、インストールへ 続行ボタンをクリックしてください。次のページが表示されるはずです:

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

サイトを編集するをクリックします。次のページにConcrete5のダッシュボードが表示されるはずです:

Let's Encrypt SSLを使用してConcrete5を安全にする

オープンウェブサイトをLet's Encrypt SSLで保護したい場合は、Certbotクライアントパッケージをインストールして、オープンウェブサイトのLet's Encrypt SSLをインストールおよび管理する必要があります。

次のコマンドを実行してインストールできます:

apt-get install python3-certbot-apache -y

Certbotパッケージがインストールされたら、次のコマンドを実行して、あなたのウェブサイトのためにLet's Encrypt SSLをダウンロードしてインストールしてください。

certbot --apache -d concrete5.yourdomain.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 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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.yourdomain.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キーを押すと、あなたのウェブサイト用にLet's Encrypt SSLがインストールされます:

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.yourdomain.com

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/concrete5.yourdomain.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/open.yourdomain.com/privkey.pem
   Your cert will expire on 2022-03-11. 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.yourdomain.com を使って自分のウェブサイトに安全にアクセスできるようになりました。

結論

おめでとうございます!あなたはDebian 11にApacheとLet's Encrypt SSLを使用してConcrete5 CMSを正常にインストールしました。これでウェブブラウザから簡単にウェブサイトを作成および編集できます。質問があれば気軽にお尋ねください。

関連記事: