Textpatternは、無料のオープンソースPHPコンテンツ管理システムです。テーマとプラグインを介して適切なカスタマイズ性を提供しながら、かなり軽量で高速で使いやすいです。このガイドでは、Textpatternを新しいDebian10インスタンスにインストールします。
- rootユーザーまたはsudo権限を持つ任意のユーザーにアクセスできる新しいDebian10システム。
- サーバーを指す登録済みドメイン名。
sudoユーザーとしてログインしている場合は、次の設定でrootに切り替えます。
sudo su -
$VISUAL環境変数を好みのテキストエディタに設定します。たとえば、nanoを使用するには:
echo "export VISUAL=nano" >> ~/.profile . ~/.profile
ステップ1:必要なソフトウェアをインストールします。
システムのパッケージキャッシュを更新します:
apt update
次に、Nginx、PHP-FPM、必要なPHP拡張機能、MariaDB、およびcertbotをインストールします。
apt install -y nginx mariadb-server php-fpm php-xml php-mysql php-json php-mbstring php-zip certbot
NginxおよびMariaDBサービスが有効で実行されていることを確認します:
systemctl enable --now nginx.service mariadb.service
ステップ2:テキストパターンのダウンロード
Githubのリリースから最新のテキストパターンリリースのダウンロードリンク(.tar.gz形式)をコピーし、次のようにwgetを使用してサーバーにダウンロードします。
wget https://github.com/textpattern/textpattern/releases/download/4.7.3/textpattern-4.7.3.tar.gz
次に、アーカイブを解凍し、コンテンツをwebrootディレクトリ内の場所に移動します。
tar -xzf textpattern*.tar.gz rm textpattern*.tar.gz mv textpattern* /var/www/html/textpattern
ステップ3:データベースのセットアップ
mysql_secure_installationスクリプトを実行して、基本的なセキュリティ強化を実行することから始めます。
mysql_secure_installation
以下に示すように質問に答え、rootユーザーの安全なパスワードを選択してください:
Enter current password for root (enter for none):Set root password? [Y/n] y New password: your_password Re-enter new password: your_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
次に、Textpatternで使用するデータベースとユーザーを作成します。次のコマンドでMySQLシェルにログインします:
mysql -u root -p
ルートパスワードを入力してから、次のステートメントを発行します。 textpattern_user_passwordを適切なパスワードに置き換えてください。
MariaDB [(none)]> CREATE DATABASE textpattern_db; MariaDB [(none)]> CREATE USER textpattern_user IDENTIFIED BY 'textpattern_user_password'; MariaDB [(none)]> GRANT ALL PRIVILEGES ON textpattern_db.* TO textpattern_user; MariaDB [(none)]> \q
ステップ4:Nginx構成
まず、次のコマンドを実行して、ドメインのSSL証明書を取得します。
certbot certonly --webroot --webroot-path /var/www/html -d "your_domain" -m "[email protected]"
ドメインが正しく構成されていると仮定すると、certbotはHTTPSの構成に使用する証明書を自動的に取得します。
次に、デフォルトのNginxサーバー構成ファイルを無効にします。
rm /etc/nginx/sites-enabled/default
次に、/ etc / nginx / sites-available:
の下にある新しい構成ファイルを開きます。$VISUAL /etc/nginx/sites-available/textpattern
そして、your_domainをドメイン名に置き換えて、次の適切な構成を入力します。
server { listen 80; #replace your_domain below server_name your_domain; return 301 https://$server_name$request_uri; } server { listen 443 ssl; #replace your_domain below server_name your_domain; root /var/www/html/textpattern; index index.php; ssl on; #replace your_domain below ssl_certificate /etc/letsencrypt/live/your_domain/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/your_domain/privkey.pem; location ~* \.php$ { fastcgi_pass unix:/run/php/php7.3-fpm.sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } }
この構成では、すべてのHTTPリクエストがHTTPSにリダイレクトされることに注意してください。特定の設定や要件がある場合は、変更することをお勧めします。満足したら、sites対応ディレクトリにシンボリックリンクを作成します。
ln -s /etc/nginx/sites-available/textpattern /etc/nginx/sites-enabled/
次に、次の構文エラーがないか確認します。
nginx -t
最後に、次のコマンドを発行して、新しい構成をロードします。
systemctl reload nginx.service
ステップ5:テキストパターンの構成
これで、Textpatternのインストールにアクセスできるようになりますが、まだ構成されていません。 https:// your_domain / textpattern / setup /にアクセスして、Webインストーラーを開始します。言語を選択したら、データベースの詳細を入力します:
- MySQLユーザー名:textpattern_user
- MySQLパスワード:手順2でtextpattern_userに選択したパスワードを入力します。
- MySQLサーバー:localhost
- MySQLデータベース:textpattern_db
- テーブルプレフィックス:空白のままにします
インストーラーは、対応する構成を生成する前に、入力されたデータベース資格情報を確認します。必要なファイルを作成します:
$VISUAL /var/www/html/textpattern/textpattern/config.php
生成された構成を貼り付け、ファイルを保存して終了します。 Webインストーラーの次のステップに進みます。ここで、CMS管理者アカウントとサイト構成の情報を入力するように求められます。それが完了したら、セットアップディレクトリを削除します:
rm -rf /var/www/html/textpattern/textpattern/setup
そして、Textpatternが書き込みアクセスを必要とするディレクトリのNginxシステムユーザー所有権を与えます:
chown -R www-data /var/www/html/textpattern/{files,images,themes}
これで、Textpatternサイトを使用する準備が整いました。管理インターフェースには、https:// your_domain/textpatternでアクセスできます。
- このガイドでcertbotを使用した証明書の管理について学ぶ