Phorumは、PHPおよびMySQLベースのオープンソースフォーラムソフトウェアです。このガイドでは、WebサーバーとしてNginx、データベースとしてMariaDB、acme.shとLet's Encrypt for HTTPSを使用して、Debian9オペレーティングシステムにPhorumをインストールするプロセスを段階的に説明します。
Phorumを実行するための要件は次のとおりです。
- Nginx
- PHPバージョン5.2以降
- MySQL/MariaDBバージョン5.0以降
- Debian9オペレーティングシステム。
-
sudo
を持つroot以外のユーザー 特権。
Debianのバージョンを確認してください:
lsb_release -ds
# Debian GNU/Linux 9.8 (stretch)
タイムゾーンを設定します:
sudo dpkg-reconfigure tzdata
オペレーティングシステムパッケージ(ソフトウェア)を更新します。これは、オペレーティングシステムのデフォルトのソフトウェアパッケージの最新の更新とセキュリティ修正を確実に行うための重要な最初のステップです。
sudo apt update && sudo apt upgrade -y
Debianオペレーティングシステムの基本的な管理に必要ないくつかの重要なパッケージをインストールします:
sudo apt install -y curl wget vim git unzip socat bash-completion apt-transport-https build-essential
PHPと必要なPHP拡張機能をインストールします:
sudo apt install -y php7.0 php7.0-cli php7.0-fpm php7.0-common php7.0-mysql
モジュールにコンパイルされたPHPを表示するには、次のコマンドを実行できます。
php -m
ctype
curl
exif
fileinfo
. . .
. . .
PHPのバージョンを確認してください:
php --version
# PHP 7.0.33-0debian0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
# with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
PHP-FPMサービスは、Ubuntu 18.04システムで再起動すると自動的に開始されて有効になるため、手動で開始して有効にする必要はありません。次のステップであるデータベースのインストールとセットアップに進むことができます。
MariaDBデータベースサーバーをインストールします:
sudo apt install -y mariadb-server
MariaDBのバージョンを確認してください:
mysql --version
mysql_secure installation
を実行します MariaDBのセキュリティを向上させ、MariaDB root
のパスワードを設定するスクリプト ユーザー:
sudo mysql_secure_installation
それぞれの質問に答えてください:
Would you like to setup VALIDATE PASSWORD plugin? N
New password: your_secure_password
Re-enter new password: your_secure_password
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
rootユーザーとしてMariaDBシェルに接続します:
sudo mysql -u root -p
# Enter password
Phorum用の空のMariaDBデータベースとユーザーを作成し、資格情報を覚えておいてください:
mariadb> CREATE DATABASE dbname;
mariadb> GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
mariadb> FLUSH PRIVILEGES;
MariaDBを終了します:
mariadb> exit
dbname
を置き換えます 、username
およびpassword
自分の名前で。
ステップ3-acme.shクライアントをインストールし、Let's Encrypt証明書を取得します(オプション)
HTTPSでフォーラムを保護する必要はありませんが、サイトのトラフィックを保護することをお勧めします。 Let's EncryptからTLS証明書を取得するには、acme.shクライアントを使用します。 Acme.shは、依存関係がゼロのLet'sEncryptからTLS証明書を取得するための純粋なUNIXシェルソフトウェアです。
acme.shをダウンロードしてインストールします:
sudo su - root
git clone https://github.com/Neilpang/acme.sh.git
cd acme.sh
./acme.sh --install --accountemail [email protected]
source ~/.bashrc
cd ~
acme.shのバージョンを確認してください:
acme.sh --version
# v2.8.0
RSAを取得する およびECC/ ECCSA ドメイン/ホスト名の証明書:
# RSA 2048
acme.sh --issue --standalone -d example.com --keylength 2048
# ECDSA
acme.sh --issue --standalone -d example.com --keylength ec-256
テスト用の偽の証明書が必要な場合は、--staging
を追加できます。 上記のコマンドにフラグを立てます。
上記のコマンドを実行した後、証明書 およびキー になります:
- RSAの場合 :
/home/username/example.com
ディレクトリ。 - ECC/ECDSAの場合 :
/home/username/example.com_ecc
ディレクトリ。
発行された証明書を一覧表示するには、次のコマンドを実行できます:
acme.sh --list
証明書を保存するディレクトリを作成します。 /etc/letsencrypt
を使用します ディレクトリ。
mkdir -p /etc/letsecnrypt/example.com
sudo mkdir -p /etc/letsencrypt/example.com_ecc
証明書を/etc/letsencryptディレクトリにインストール/コピーします。
# RSA
acme.sh --install-cert -d example.com --cert-file /etc/letsencrypt/example.com/cert.pem --key-file /etc/letsencrypt/example.com/private.key --fullchain-file /etc/letsencrypt/example.com/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"
# ECC/ECDSA
acme.sh --install-cert -d example.com --ecc --cert-file /etc/letsencrypt/example.com_ecc/cert.pem --key-file /etc/letsencrypt/example.com_ecc/private.key --fullchain-file /etc/letsencrypt/example.com_ecc/fullchain.pem --reloadcmd "sudo systemctl reload nginx.service"
すべての証明書は60日ごとに自動的に更新されます。
証明書を取得したら、rootユーザーを終了し、通常のsudoユーザーに戻ります。
exit
NGINXをインストールします:
sudo apt install -y nginx
NGINXのバージョンを確認してください:
sudo nginx -v
# nginx version: nginx/1.14.0 (Ubuntu)
Phorum用にNGINXを構成します。 sudo vim /etc/nginx/sites-available/phorum.conf
を実行します 次の構成を追加します。
server {
listen 80;
listen 443 ssl;
server_name example.com;
root /var/www/phorum;
ssl_certificate /etc/letsencrypt/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com/private.key;
ssl_certificate /etc/letsencrypt/example.com_ecc/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/example.com_ecc/private.key;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
}
}
新しいphorum.conf
をアクティブにします ファイルをsites-enabled
にリンクして構成する ディレクトリ:
sudo ln -s /etc/nginx/sites-available/phorum.conf /etc/nginx/sites-enabled
構文エラーがないかNGINX構成を確認してください:
sudo nginx -t
NGINXサービスをリロードします:
sudo systemctl reload nginx.service
Phorumのドキュメントルートディレクトリを作成します:
sudo mkdir -p /var/www/phorum
/var/www/phorum
の所有権を変更します [jour_user] :
sudo chown -R [your_user]:[your_user] /var/www/phorum
ドキュメントのルートディレクトリに移動します:
cd /var/www/phorum
公式ウェブサイトから最新の安定したPhorumディストリビューションをダウンロードしてください:
wget https://www.phorum.org/downloads/phorum-5.2.23.tar.gz
ダウンロードしたアーカイブを解凍し、ファイルをドキュメントルートに移動します:
tar xvzf phorum-5.2.23.tar.gz
rm phorum-5.2.23.tar.gz
mv Core-phorum_5_2_23/* . && mv Core-phorum_5_2_23/.* .
rmdir Core-phorum_5_2_23
データベースアクセスを構成します:
cp include/db/config.php.sample include/db/config.php
include/db/config.php
を編集してデータベース設定を構成します ファイル:
vim include/db/config.php
/var/www/phorum
の所有権を変更します www-data:
へのディレクトリ
sudo chown -R www-data:www-data /var/www/phorum
インストールを完了するには、http://forum.example.com/admin.php
にアクセスしてWebベースのインストーラーを実行します。 Webブラウザで。