GNU/Linux >> Linux の 問題 >  >> Cent OS

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

ElkArteは、SimpleMachineForumに基づく無料のオープンソースフォーラムソフトウェアです。 PHPで記述されており、MariaDBをデータベースバックエンドとして使用します。フル機能のコミュニティフォーラムを構築するために必要なすべての機能を提供します。シンプルで軽量で、最新のブラウザ、スマートフォン、タブレットに適したレスポンシブテーマを使用しています。

機能

  • シンプルでユーザーフレンドリーなインターフェース
  • カスタマイズ可能で組み込みのアドオンマネージャー
  • スパム対策機能の改善
  • 添付ファイルをドラッグアンドドロップします
  • YouTube、vimeo、dailymotion用の統合ビデオ埋め込み

このチュートリアルでは、Let'sEncryptSSLを使用してElkArteをCentOS8にインストールする方法を示します。

前提条件
  • CentOS8を実行しているサーバー。
  • サーバーIPで指定された有効なドメイン名。
  • ルートパスワードがサーバーに設定されます。

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

まず、Apache、MariaDB、PHP、およびその他の拡張機能をシステムにインストールする必要があります。次のコマンドを実行して、それらすべてをインストールできます。

dnf install httpd mariadb-server php php-common php-json php-curl php-intl php-mbstring php-xmlrpc php-mysqlnd php-gd php-pgsql php-xml php-cli php-bcmath php-gmp php-zip unzip -y

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

nano /etc/php.ini

次の値を変更します。

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago

ファイルを保存して閉じてから、ApacheおよびMariaDBサービスを開始し、次のコマンドを使用してシステムの再起動時に開始できるようにします。

systemctl start httpd
systemctl start mariadb
systemctl enable httpd
systemctl enable mariadb

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

MariaDBを構成する

デフォルトでは、MariaDBルートパスワードは設定されていません。したがって、システムに設定する必要があります。これを行うには、次のスクリプトを実行します。

mysql_secure_installation

以下に示すようにすべての質問に答えて、ルートパスワードを設定します。

Enter current password for root (enter for none):
OK, successfully used password, moving on...
Set root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

MariaDBが保護されたら、次のコマンドを使用してMariaDBシェルにログインします。

mysql -u root -p

プロンプトが表示されたらrootパスワードを入力し、次のコマンドでデータベースとユーザーを作成します。

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

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

MariaDB [(none)]> GRANT ALL ON elkarte.* TO 'elkarte'@'localhost' WITH GRANT OPTION;

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

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

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

ElkArteをダウンロード

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

wget https://github.com/elkarte/Elkarte/archive/master.zip

ダウンロードしたら、次のコマンドでダウンロードしたファイルを解凍します。

unzip master.zip

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

mv Elkarte-master /var/www/html/elkarte

次に、次のコマンドを使用して所有権と権限を変更します。

chown -R apache:apache /var/www/html/elkarte
chmod -R 775 /var/www/html/elkarte

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

ElkArte用にApacheを構成する

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

nano /etc/httpd/conf.d/elkarte.conf

次の行を追加します:

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

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

     ErrorLog /var/log/httpd/error.log
     CustomLog /var/log/httpd//access.log combined

</VirtualHost>
systemctl restart httpd

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

Selinuxとファイアウォールを構成する

デフォルトでは、SELinuxはCentOS 8で有効になっているため、ElkArteWebサイト用に構成する必要があります。

次のコマンドでSELinuxを設定できます:

setsebool httpd_can_network_connect on -P
chcon -R -u system_u -t httpd_sys_rw_content_t -r object_r /var/www/html/elkarte

次に、次のコマンドを使用して、ポート80と443がファイアウォールを通過できるようにします。

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload

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

アクセスElkArte

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

続行をクリックします ボタンをクリックしてインストールを開始します。次のページが表示されます:

データベースの詳細を入力し、続行をクリックします ボタン。次のページが表示されます:

フォーラム名とURLを入力し、続行をクリックします ボタン。次のページが表示されます:

次に、続行をクリックします ボタンをクリックしてデータベースにデータを入力します。次のページが表示されます:

管理者のユーザー名、パスワード、メールアドレスを入力し、続行をクリックします ボタン。次のページが表示されます:

新しくインストールしたフォーラムをクリックします ボタン。次のページが表示されます:

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

SSLを暗号化してLet'sでElkarteを保護

この時点で、ElkArteがインストールおよび構成されています。次に、Let'sEncryptSSLを使用してElkArteサイトを保護することをお勧めします。まず、Certbotクライアントをシステムにインストールする必要があります。 Certbotは、Let's Encrypt WebサイトからSSLをダウンロードし、ダウンロードしたSSLを使用するようにApacheWebサーバーを構成するために使用できるLet'sEncryptクライアントです。

次のコマンドでCertbotをインストールできます:

wget https://dl.eff.org/certbot-auto
mv certbot-auto /usr/local/bin/certbot-auto
chown root /usr/local/bin/certbot-auto
chmod 0755 /usr/local/bin/certbot-auto

次に、次のコマンドを実行して、ElkArteWebサイトのSSL証明書を取得してインストールします。

certbot-auto --apache -d elk.example.com

上記のコマンドは、最初に必要なすべての依存関係をサーバーにインストールします。インストールすると、以下に示すように、メールアドレスを入力して利用規約に同意するよう求められます。

注:SSL関連のエラーが発生した場合は、httpdサービスを再起動して、上記のコマンドを再度実行してください。

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 elk.example.com
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/httpd/conf.d/elkarte-le-ssl.conf
Deploying Certificate to VirtualHost /etc/httpd/conf.d/elkarte-le-ssl.conf

次に、HTTPトラフィックをHTTPSにリダイレクトするかどうかを選択し、HTTPアクセスを削除します。

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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キーを押して、インストールプロセスを開始します。インストールが正常に完了すると、次の出力が表示されます。

Redirecting vhost in /etc/httpd/conf.d/elkarte.conf to ssl vhost in /etc/httpd/conf.d/elkarte-le-ssl.conf

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

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/elk.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/elk.example.com/privkey.pem
   Your cert will expire on 2020-05-10. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot-auto
   again with the "certonly" option. To non-interactively renew *all*
   of your certificates, run "certbot-auto 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

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

結論

おめでとう!これで、CentOS8にApacheとLet'sEncrypt SSLを使用してElkArteが正常にインストールされました。これで、独自のオンラインフォーラムの構築を開始できます。ご不明な点がございましたら、お気軽にお問い合わせください。


Cent OS
  1. Nginxを使用してWonderCMSをインストールし、CentOS7でSSLを暗号化する方法

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

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

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

  2. CentOS8にNginxとLESSSLを使用してFlarumフォーラムをインストールする方法

  3. バニラフォーラムをインストールし、CentOS8でLetsEncryptを使用して保護する方法

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

  2. Nginxを使用してAskbotをインストールし、CentOS8でLetsEncryptを使用して保護する方法

  3. NGINXを使用してShopware6をインストールし、CentOS8で暗号化する方法