Ubuntu 20.04にSSLを暗号化してTYPO3CMSをインストールする方法

Ubuntu/Debian

目次

TYPO3はPHPで書かれた無料のオープンソースコンテンツ管理システムです。これは、オープンソースコードと信頼性および真のスケーラビリティを組み合わせたエンタープライズクラスのCMSです。 Webサーバー上で実行され、Windows、Linux、macOSなどの多くのオペレーティングシステムをサポートします。シンプルで応答性が高く、モバイル対応で安全なCMSであり、コードを記述せずに簡単にカスタマイズおよび拡張できます。それはあなたのウェブサイトを素早く立ち上げて実行するための非常に人気があり素晴らしい選択です。

このチュートリアルでは、ApacheWebサーバーでTYPO3CMSをインストールし、Ubuntu20.04でSSLを暗号化する方法を示します。

前提条件

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

入門

まず、システムパッケージを最新バージョンに更新することをお勧めします。次のコマンドを実行して、すべてのパッケージを更新できます。

apt-get update -y

すべてのパッケージが最新になったら、次のステップに進むことができます。

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

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

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

すべてのパッケージをインストールした後、php.iniファイルを編集し、いくつかの推奨設定を変更します。

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

次の行を変更します。

memory_limit = 256M
upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 360
max_input_vars = 1500
date.timezone = Asia/Tokyo

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

systemctl restart apache2

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

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

mysql

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

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

次に、次のコマンドを使用して、typo3dbにすべての権限を付与します。

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

次に、特権をフラッシュし、次のコマンドでMariaDBを終了します。

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

この時点で、MariaDBデータベースが構成されます。

TYPO3CMSをインストールする

まず、公式ウェブサイトからTYPO3の最新バージョンをダウンロードする必要があります。 curlコマンドを使用してダウンロードできます。

curl -L -o typo3_src.tgz https://get.typo3.org/10.4.9

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

tar -xvzf typo3_src.tgz

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

mv typo3_src-10.4.9 /var/www/html/typo3

次に、次のコマンドを使用して適切な許可と許可を与えます。

chown -R www-data:www-data /var/www/html/typo3
 chmod -R 775 /var/www/html/typo3

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

TYPO3用にApacheを設定する

次に、TYPO3CMSをホストするためのApache仮想ホスト構成ファイルを作成します。次のコマンドで作成できます。

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

次の行を追加します。

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/typo3
     ServerName typo3.example.com
     <Directory /var/www/html/typo3>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
     </Directory>

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

</VirtualHost>

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

a2ensite typo3.conf
 a2enmod rewrite

次に、Apacheサービスを再起動して、変更を適用します。

systemctl restart apache2

この時点で、ApacheWebサーバーはTYPO3を提供するように設定されています。これで、次のステップに進むことができます。

TYPO3CMSにアクセスする

次に、Webブラウザーを開き、URLhttp //typo3.example.comを使用してTYPO3にアクセスします。次のページが表示されます。

Typo3のインストール広告

新しいサーバーにTYPO3をインストールする場合は、TYPO3ウェブルートディレクトリ内にFIRST_INSTALLファイルを作成する必要があります。次のコマンドで作成できます。

touch /var/www/html/typo3/FIRST_INSTALL

次に、Webページを更新します。次のページが表示されます。

環境の概要

[問題は検出されませんでした]をクリックし、インストールを続行します。次のページが表示されます。

データベースを構成します

データベースのユーザー名、パスワード、ホストを入力し、[続行]ボタンをクリックします。次のページが表示されます。

既存のデータベースを使用する

TYPO3データベース名を選択し、続行ボタンをクリックしてください。次のページが表示されます。

管理者ユーザーを作成する

次に、管理者のユーザー名、パスワード、サイト名を入力し、[続行]ボタンをクリックします。 TYPO3ログインページにリダイレクトされます:広告

 

Typo3ログイン

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

Typo3管理ダッシュボード

Let’sEncryptでTYPO3を保護する

Let’s Encrypt FreeSSLを使用してWebサイトを保護することをお勧めします。まず、Certbotクライアントをインストールして、SSLをインストールおよび管理します。次のコマンドでインストールできます。

apt-get install python3-certbot-apache -y

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

certbot --apache -d typo3.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 typo3.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/typo3-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/typo3-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/typo3-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’s EncryptSSLをインストールします。

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

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

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/typo3.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/typo3.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

これで、URLhttps://typo3.example.comを使用してTYPO3CMSに安全にアクセスできます

結論

おめでとう!これでTYPO3CMSが正常にインストールされ、Ubuntu20.04でLet’sEncryptSSLを使用して保護されました。これで、Webブラウザを介してWebサイトとブログを簡単に作成できます。ご不明な点がございましたら、お気軽にお問い合わせください。

Source

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です