Ubuntu 20.04にApacheと無料のLet's Encrypt SSLを使用してConcrete5 CMSをインストールする方法
Ubuntu 20.04にApacheと無料のLet's Encrypt SSLを使用してConcrete5 CMSをインストールする方法
このページで
- 要件
- 始めに
- Apache、MariaDB、PHPをインストールします。
- Concrete5のデータベースを作成する
- Concrete5 CMSをダウンロードする
- Concrete5 CMSのためにApacheを設定する
- Concrete5 CMSウェブインターフェースにアクセスする
- Let's Encrypt SSLでConcrete5を安全にする
- 結論
Concrete5は、インターネット上でコンテンツを公開するために使用されるオープンソースのコンテンツ管理システムです。PHPで書かれており、データベースバックエンドとしてMariaDBを使用しています。ウェブブラウザを通じてページやコンテンツを作成するのに役立つ使いやすいビルダーを提供します。柔軟性があり、安全で、モバイル対応で、MVC(モデル-ビュー-コントローラ)アーキテクチャに基づいています。WYSIWYGコンテンツエディター、メディアマネージャー、ドラッグアンドドロップコンテンツ、インコンテキスト編集など、豊富な機能を提供しています。
この記事では、Ubuntu 20.04サーバーにApacheとLet's Encrypt SSLを使用してConcrete5 CMSをインストールする方法を紹介します。
要件
- Ubuntu 20.04を実行しているサーバー。
- サーバーIPにポイントされた有効なドメイン名。
- サーバーにルートパスワードが設定されています。
始めに
まず、APTパッケージインデックスを最新のバージョンに更新する必要があります。以下のコマンドで更新できます:
apt-get update -yAPTインデックスが更新されたら、次のステップに進むことができます。
Apache、MariaDB、PHPをインストールします。
次に、Apacheウェブサーバー、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;完了したら、次のステップに進むことができます。
Concrete5 CMSをダウンロードする
まず、Concrete5 CMSのウェブサイトに行き、Concrete5の最新バージョンのURLをコピーして、次のコマンドでダウンロードしてください。
wget --trust-server-names https://www.concrete5.org/download_file/-/view/115589/ -O concrete5.zip
ダウンロードが完了したら、以下のコマンドでダウンロードしたファイルを展開します:
unzip concrete5.zip次に、抽出したディレクトリを次のコマンドを使用してApacheのウェブルートディレクトリに移動してください:
mv concrete5-* /var/www/html/concrete5次に、次のコマンドを使用してConcrete5ディレクトリに適切な権限と所有権を設定します。
chown -R www-data:www-data /var/www/html/concrete5/
chmod -R 755 /var/www/html/concrete5/完了したら、次のステップに進むことができます。
Concrete5 CMSのためにApacheを設定する
次に、Concrete5 CMSのためにApacheの仮想ホスト設定ファイルを作成する必要があります。以下のコマンドで作成できます:
nano /etc/apache2/sites-available/concrete5.conf次の行を追加してください:
<VirtualHost *:80>
ServerAdmin [email
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 ubunt4 systemd[1]: Starting The Apache HTTP Server...
この時点で、ApacheウェブサーバーはConcrete5 CMSをホストするように設定されています。次のステップに進むことができます。
Concrete5 CMSウェブインターフェースにアクセスする
さて、ウェブブラウザを開き、URL http://concrete5.example.com を使用してConcrete5 CMSのウェブインターフェースにアクセスしてください。次のページにリダイレクトされます:
言語を選択し、矢印ボタンをクリックしてください。次のページが表示されるはずです:
必要なライブラリがすべてインストールされていることを確認し、次に インストールに続く ボタンをクリックしてください。次のページが表示されるはずです:
ここに管理者のユーザー名、パスワード、データベースのユーザー名、パスワード、およびデータベース名を入力し、インストール Concrete5 ボタンをクリックしてインストールを開始します。インストールが完了すると、次のページが表示されます:
今、サイトを編集するボタンをクリックしてください。次のページにConcrete5のダッシュボードが表示されるはずです。
Let's Encrypt SSLでConcrete5を安全にする
次に、Let's Encrypt SSLでウェブサイトを保護することをお勧めします。まず、以下のコマンドを使用してCertbotクライアントをインストールしてください:
apt-get install python3-certbot-apache -yインストールが完了したら、次のコマンドを実行して、Let's Encrypt SSLでウェブサイトを保護してください。
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
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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キーを押すと、あなたのウェブサイト用に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.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 を使用して、安全にConcrete 5にアクセスできます。
結論
上記のガイドでは、ApacheとLet's Encrypt SSLを使用してUbuntu 20.04にConcrete5 CMSをインストールする方法について学びました。これで、Concrete5 CMSを使用してインターネット上にコンテンツを簡単に公開できるようになりました。質問があればお気軽にお知らせください。





