Vanillaは、独自のフォーラムサイトを構築するために使用できる、無料のオープンソースで柔軟なコミュニティフォーラムソフトウェアです。これは、軽量で多言語のフォーラムソリューションであり、数分以内にオンラインコミュニティを設定するのに役立ちます。 PHPで書かれており、たくさんのアドオンやテーマが付属しています。プレミアム機能が満載されており、トップブランドが顧客を引き付け、ロイヤルティを高め、サポートコストを削減するために使用しています。
このチュートリアルでは、CentOS 8にVanillaフォーラムをインストールし、Let'sEncryptSSLで保護する方法を学習します。
- CentOS8を実行しているサーバー。
- ルートパスワードがサーバーに設定されています。
LEMPサーバーをインストールする
まず、Nginx Webサーバー、MariaDBデータベースサーバー、PHP、およびその他の必要なPHP拡張機能をシステムにインストールする必要があります。次のコマンドを実行して、それらすべてをインストールできます。
dnf install nginx mariadb-server php php php-mysqlnd php-opcache php-xml php-xmlrpc php-gd php-mbstring php-json php-fpm php-curl php-pear php-openssl php-intl unzip -y
すべてのパッケージをインストールした後、Nginx、PHP-FPM、およびMariaDBサービスを開始し、次のコマンドを使用してシステムの再起動後にそれらを開始できるようにします。
systemctl start nginx
systemctl start php-fpm
systemctl start mariadb
systemctl enable nginx
systemctl enable php-fpm
systemctl enable mariadb
MariaDBデータベースを構成する
始める前に、MariaDBを保護することをお勧めします。次のスクリプトで保護できます:
mysql_secure_installation
以下に示すように、すべての質問に答えてください。
Enter current password for root (enter for none): Set root password? [Y/n] Y New password: Re-enter new 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
MariaDBを保護した後、次のコマンドを使用してMariaDBシェルにログインします。
mysql -u root -p
次のコマンドを使用して、MariaDBのrootパスワードを入力し、Vanillaのデータベースとユーザーを作成します。
MariaDB [(none)]> CREATE DATABASE vanilladb CHARACTER SET utf8 COLLATE utf8_general_ci;
MariaDB [(none)]> CREATE USER 'vanilla'@'localhost' IDENTIFIED BY 'password';
次に、次のコマンドを使用して、Vanillaデータベースにすべての権限を付与します。
MariaDB [(none)]> GRANT ALL PRIVILEGES ON vanilladb.* TO 'vanilla'@'localhost';
次に、特権をフラッシュし、次のコマンドを使用してMariaDBシェルを終了します。
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
次のコマンドを使用して、公式WebサイトからVanillaフォーラムの最新の安定バージョンをダウンロードできます。
wget https://open.vanillaforums.com/get/vanilla-core-3.3.zip
ダウンロードしたら、次のコマンドでダウンロードしたファイルを解凍します。
unzip vanilla-core-3.3.zip
次に、次のコマンドを使用して、抽出したディレクトリをNginxWebルートディレクトリに移動します。
mv package /var/www/html/vanilla
次に、vanillaディレクトリの所有権をNginxに変更します:
chown -R nginx:nginx /var/www/html/vanilla
完了したら、次のステップに進むことができます。
PHP-FPMプールを構成する
デフォルトでは、PHP-FPMはApache用に構成されています。ここでは、NginxをWebサーバーとして使用します。したがって、Nginx用にPHP-FPMを構成する必要があります。ファイル/etc/php-fpm.d/www.confを編集することでそれを行うことができます:
nano /etc/php-fpm.d/www.conf
次の行を変更します:
user = nginx group = nginx
終了したら、ファイルを保存して閉じます。次に、PHPのセッションディレクトリを作成し、その所有権を変更します。
mkdir -p /var/lib/php/session
chown -R nginx:nginx /var/lib/php/session
次に、PHP-FPMサービスを再起動して、変更を適用します。
systemctl restart php-fpm
次に、Vanillaフォーラムにサービスを提供する新しいNginx仮想ホストファイルを作成します。
nano /etc/nginx/conf.d/vanilla.conf
次の行を追加します:
server { listen 80; server_name vanilla.linuxbuz.com; root /var/www/html/vanilla; index index.php; location ~* /\.git { deny all; return 403; } location /build/ { deny all; return 403; } location /cache/ { deny all; return 403; } location /cgi-bin/ { deny all; return 403; } location /uploads/import/ { deny all; return 403; } location /conf/ { deny all; return 403; } location /tests/ { deny all; return 403; } location /vendor/ { deny all; return 403; } location ~* ^/index\.php(/|$) { fastcgi_split_path_info ^(.+\.php)(/.+)$; try_files $fastcgi_script_name =404; set $path_info $fastcgi_path_info; fastcgi_param PATH_INFO $path_info; fastcgi_index index.php; include fastcgi.conf; fastcgi_param SCRIPT_NAME /index.php; fastcgi_param SCRIPT_FILENAME $realpath_root/index.php; fastcgi_param X_REWRITE 1; fastcgi_pass unix:/var/run/php-fpm/www.sock; } location ~* \.php(/|$) { rewrite ^ /index.php$uri last; } location / { try_files $uri $uri/ @vanilla; } location @vanilla { rewrite ^ /index.php$uri last; } }
終了したら、ファイルを保存して閉じます。次に、Nginxサービスを再起動して、変更を適用します。
systemctl restart nginx
次に、システムにCertbotユーティリティをインストールして、VanillaWebサイト用のLet'sEncryptSSLをダウンロードしてインストールする必要があります。
次のコマンドを使用して、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
次に、次のコマンドを使用して、VanillaWebサイトのSSL証明書を取得してインストールします。
certbot-auto --nginx -d vanilla.linuxbuz.com
上記のコマンドは、最初に必要なすべての依存関係をサーバーにインストールします。インストールすると、以下に示すように、メールアドレスを入力して利用規約に同意するよう求められます。
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator nginx, Installer nginx 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 vanilla.linuxbuz.com Waiting for verification... Cleaning up challenges Deploying Certificate to VirtualHost /etc/nginx/conf.d/vanilla.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を押します 続ける。インストールが正常に完了すると、次の出力が表示されます。
Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/vanilla.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://vanilla.linuxbuz.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=vanilla.linuxbuz.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/vanilla.linuxbuz.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/vanilla.linuxbuz.com/privkey.pem Your cert will expire on 2020-06-11. 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" - 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
デフォルトでは、SELinuxはCentOS 8で有効になっているため、VanillaフォーラムのWebサイト用に構成する必要があります。
次のコマンドで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/vanilla
次に、次のコマンドを使用して、ポート80と443がファイアウォールを通過できるようにします。
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
完了したら、次のステップに進むことができます。
Webブラウザーを開き、URLhttps://vanilla.linuxbuz.comにアクセスします。次のページにリダイレクトされます:
データベースの詳細、アプリケーションのタイトル、電子メール、管理者のユーザー名、パスワードを入力し、続行をクリックします ボタン。インストールが完了すると、次のページにVanillaダッシュボードが表示されます。
おめでとう! Let'sEncryptSSLを使用してCentOS8にVanillaフォーラムを正常にインストールしました。これで、独自のコミュニティフォーラムWebサイトを簡単にホストできます。ご不明な点がございましたら、お気軽にお問い合わせください。