GNU/Linux >> Linux の 問題 >  >> Debian

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

Automadは、PHP言語で記述された無料のオープンソースのフラットコンテンツ管理システムです。高速で応答性が高く、他のPHPベースのCMSでは利用できない機能を提供します。 Automadは、データベースの代わりにテキストファイルを使用してコンテンツを保存します。 Automadは、サイト、システム設定の管理、画像のアップロード、ブログ投稿の作成のためのWebベースのインターフェイスを提供します。 Automadを最新の状態に保つために、組み込みのMarkdownエディターとワンクリックアップデーターが付属しています。

このチュートリアルでは、ApacheWebサーバーを使用してDebian10にAutomadCMSをインストールする方法を示します。

要件
  • Debian10を実行しているサーバー。
  • ルートパスワードがサーバーに設定されます。
はじめに

開始する前に、システムを最新バージョンに更新する必要があります。これを行うには、次のコマンドを実行します。

apt-get update -y
apt-get upgrade -y

サーバーが更新されたら、サーバーを再起動して変更を適用します。

ApacheとPHPをインストールする

AutomadはPHPに基づいており、Webサーバー上で実行されます。そのため、Apache、PHP、およびその他の必要なモジュールをサーバーにインストールする必要があります。次のコマンドを実行して、それらすべてをインストールできます。

apt-get install apache2 php libapache2-mod-php php-zip php-curl php-mbstring php-gd php-xml php-xmlrpc php-soap unzip -y

すべてのパッケージがインストールされたら、Apache Webサーバーを起動し、次のコマンドを使用してシステムの再起動時に起動できるようにします。

systemctl start apache2
systemctl enable apache2

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

Automadをインストールする

まず、Bitbucketリポジトリから最新バージョンのAutomadをダウンロードする必要があります。次のコマンドでダウンロードできます:

wget https://bitbucket.org/marcantondahmen/automad/get/default.zip

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

unzip default.zip

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

mv marcantondahmen-automad-c241e88edc3c /var/www/html/automad

次に、automadディレクトリの所有権をwww-dataに変更し、次のコマンドで適切な権限を付与します。

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

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

Automad用にApacheを構成する

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

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

次のコンテンツを追加します:

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

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

     ErrorLog ${APACHE_LOG_DIR}/automadcms_error.log
     CustomLog ${APACHE_LOG_DIR}/automadcms_access.log combined

</VirtualHost>

終了したら、ファイルを保存して閉じます。次に、次のコマンドを使用して、Apacheに構文エラーがないか確認します。

apachectl configtest

すべてが正常であれば、次の出力が得られるはずです:

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK

次に、Apache仮想ホストを有効にし、次のコマンドでモジュールを書き換えます。

a2ensite automad
a2enmod rewrite

最後に、Apache Webサーバーを再起動して、構成の変更を適用します。

systemctl restart apache2

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

オートマッドにアクセス

Automadがインストールおよび構成されたので、AutomadWebインターフェイスにアクセスします。

Webブラウザーを開き、URLhttp://example.comを入力します。次の画面でAutomadサイトにリダイレクトされます:

Automadアカウントを作成するには、Webブラウザーを開き、URLhttp://example.com/dashboardにアクセスします。次のページにリダイレクトされます:

次に、希望のユーザー名とパスワードを入力し、ダウンロードをクリックします。 アカウント ファイル ボタンをクリックして、ユーザー登録フォームをダウンロードし、構成ディレクトリ内にコピーします。

mv config.php /var/www/html/automad/config/

次に、次のコマンドを使用してconfig.phpファイルに適切な権限を付与します。

chown -R www-data:www-data /var/www/html/automad/config/config.php

次に、Webブラウザーを開き、URLhttp://example.com/dashboardを入力します。 Automadログインページが表示されます:

次に、ユーザー名とパスワードを入力して、ログをクリックします。 ボタンで。次のページにAutomadCMSのデフォルトダッシュボードが表示されます。

Let'sEncryptを使用してAutomadを保護する

まず、Certbotツールをインストールして、WebサイトにLet'sEncryptの無料SSLをダウンロードしてインストールする必要があります。

まず、次のコマンドを使用してCertbotリポジトリを追加します。

apt-get install software-properties-common
add-apt-repository ppa:certbot/certbot

次に、リポジトリを更新し、次のコマンドを使用してCertbotをインストールします。

apt-get update -y
apt-get install certbot python-certbot-apache -y

インストールしたら、letsencryptディレクトリ内に.well-knownディレクトリを作成する必要があります。次のコマンドで作成できます:

mkdir -p /var/lib/letsencrypt/.well-known

次に、letsencryptディレクトリに適切な権限を与える必要があります。次のコマンドで実行できます:

chgrp www-data /var/lib/letsencrypt
chmod g+s /var/lib/letsencrypt

次に、次のコマンドを使用してwell-known.confファイルを作成します。

nano /etc/apache2/conf-available/well-known.conf

次の行を追加します:

Alias /.well-known/acme-challenge/ "/var/lib/letsencrypt/.well-known/acme-challenge/"
<Directory "/var/lib/letsencrypt/">
    AllowOverride None
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>

ファイルを保存して閉じます。次に、次のコマンドを使用して必要なモジュールを有効にします。

a2enmod ssl
a2enmod http2
a2enmod headers
a2enconf well-known

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

systemctl restart apache2

次に、次のコマンドを実行して、ドメインexample.comのLet'sEncrypt無料SSLをインストールします。

certbot --apache -d example.com

まず、有効なメールアドレスを提供し、以下に示す利用規約に同意する必要があります。

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

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を選択して、ドメインの無料のSSL証明書をダウンロードしてインストールします。インストールが正常に完了したら。次の出力が得られるはずです:

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

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

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/example.com/privkey.pem
   Your cert will expire on 2019-10-22. 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"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - 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

Automad CMSは、Let'sEncryptの無料SSLで保護されています。 URLhttps://example.comにアクセスしてアクセスできます。


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

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

  3. ElkArteフォーラムをApacheでインストールし、Debian10で暗号化する方法

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

  2. Nginxを使用してOpenCartをインストールし、Debian10で暗号化する方法

  3. Drupal 9をNginxでインストールし、Debian10でSSLを暗号化する方法

  1. Apacheを使用してPrestaShopをインストールし、CentOS8でSSLを暗号化する方法

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

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