Nginx, MariaDB and PHP (FEMP)のインストール

ここではFreeBSDに(E)Nginx、MariaDBそしてPHPをインストールする方法を記載します。
これらはしばしばFEMPと表記されます。

nginxのNではなくEngine XのEです。

目次

Nginx, MariaDB and PHP (FEMP)のインストール

各アプリケーションのバージョン選定は以下を参考にしています。

NextCloud

サーバーOS Linux(RedHat系、Debian系)
ミドルウェア
Apach/Nginx MySQL(MariaDB)/PostgreSQL PHP7以上
ストレージ Local storage, GlusterFS/Red Hat Storage, OpenStack Swift 他
ブラウザ Edge、IE11以上、Crome、Firefox、Safari
クライアントアプリ
(同期アプリ) Windows、iOS、Linux
モバイルアプリ Android、iOS

Nextcloud システム要件

WordPress

WordPress を実行するには、以下のホスティング環境を推奨します。
PHP バージョン 7.4 以上。
MySQL バージョン 5.6 以上、または MariaDB バージョン 10.1 以上。
HTTPS 対応

WordPress を実行するには、以下のホスティング環境を推奨します

MovableType

サーバー OS
Linux、Solaris / Unix、BSD
Mac OS X
Windows Server 2012 R2 / 2016
ウェブサーバー
nginx 1.2.0 以上(CGI もしくは PSGI 実行環境が別途必要となります)
Apache HTTP Server 2.0 以上
Microsoft IIS(Internet Information Services) 8.5 以上
データベース
MySQL 5.1 以上(5.7.x を推奨 / 8.0.x まで検証済み)
MariaDB 5.5 以上(10.1.x を推奨)
PostgreSQL、SQLite は未検証です。

Movable Type Advanced では、上記データベースに加えて以下のデータベースが利用できます。

Oracle Database 12c
Microsoft SQL Server 2014, 2016(Azure SQL Databsse)
Perl
5.10.1 以上(5.28 を推奨 / Perl 5.30 まで検証済み)

Perl モジュール
Movable Type を実行するには、以下の Perl モジュールが必要です。

CGI
Image::Size
File::Spec (バージョン 0.8 以上)
CGI::Cookie
LWP::UserAgent
parent
HTML::Entities (バージョン 3.6.9 以上)
Scalar::Util
Movable Type 7 では、CGI.pm をアップデートした関係から、HTML::Entities の導入が必須になっています。

また、データベース モジュールとして以下の Perl モジュールが必要です。

DBI (バージョン 1.21 以上)
DBD::mysql
これらの Perl モジュールは、Movable Type 環境チェック用 CGI の mt-check.cgi を実行することで、インストールされているかどうか確認できます。mt-check.cgi については『サーバーのシステム情報の確認』をご参照ください。

Movable Type のオプション機能を利用する為には、上記以外にもいくつかの Perl モジュールが必要となります。モジュールの一覧はこちらをご参照ください。

PHP(オプション)
5.3 以上(7.2.x 以上 を推奨 / PHP 7.4.x まで検証済み)

ダイナミックパブリッシングを利用しない場合は、PHP のインストールは必要ありません。PHP 7.1.x、7.2.x、7.3.x、7.4.x に対応しています。

文字コード
UTF-8 のみ(r.4607 以降で utf8mb4 に対応)

MovableType インストール環境

Step 1.Install Nginx Web Server

Nginxは静的ページを高速に配信する機能を有していますが、動的コンテンツを生成するためのPHPを直接制御することはできませんのでリバースプロキシー機能を使ってWebアプリケーションサーバー(Apacheなど)の動的コンテンツを配信したり、FastCGIなどCGIプロトコルを使って外部アプリケーション(PHP/Python/Perlなどのアプリケーション)を配信することが可能です。PHPのFastCGIサーバーがphp-fpm(PHP FastCGI Process Manager)です。PerlやPythonであればFcgiwrapを使用します。Nginx Web サーバーは、キャッシュ機能もあるため、外部アプリケーションの動的コンテンツをキャッシュして静的コンテンツのように配信することが可能です。そのため、CGIアプリケーションの実行頻度やデーターベースサーバへのオーバーヘッドを減らし、コンテンツ配信の応答速度を高速にするように調整できます。

まず、Nginx Webサーバーをインストールします。
NginxはPortsコレクションとPakagesとで提供されています。
以下のコマンドを実行し、インストール可能なNginx Webサーバのパッケージを確認します。

root@ik1-438-51137:~ # ls /usr/ports/www/ | grep nginx
nginx
nginx-devel
nginx-full
nginx-lite
nginx-naxsi
nginx-prometheus-exporter
nginx-ultimate-bad-bot-blocker
nginx-vts-exporter
root@ik1-438-51137:~ # pkg search -o nginx
pkg: http://pkgmir.geo.freebsd.org/FreeBSD:12:amd64/quarterly/packagesite.pkg: Not Found
security/modsecurity3-nginx    Instruction detection and prevention engine / nginx Wrapper
www/nginx                      Robust and small WWW server
www/nginx-devel                Robust and small WWW server
www/nginx-full                 Robust and small WWW server (full package)
www/nginx-lite                 Robust and small WWW server (lite package)
www/nginx-naxsi                Robust and small WWW server (plus NAXSI)
www/nginx-prometheus-exporter  Prometheus exporter for NGINX and NGINX Plus stats
www/nginx-ultimate-bad-bot-blocker Nginx bad bot and other things blocker
www/nginx-vts-exporter         Server that scraps NGINX vts stats and export them via HTTP
www/p5-Nginx-ReadBody          Nginx embeded perl module to read and evaluate a request body
www/p5-Nginx-Simple            Perl 5 module for easy to use interface for Nginx Perl Module
www/p5-Test-Nginx              Testing modules for Nginx C module development
security/py-certbot-nginx      NGINX plugin for Certbot
www/rubygem-passenger          Modules for running Ruby on Rails and Rack applications

今回は、ダイナミックモジュールをインストールしてくれるnginx-fullの最新バージョンをインストールすることにしました。
次のコマンドを実行し、nginx-fullをインストールします。

バイナリパッケージのインストール中に、パッケージマネージャーはパッケージのダウンロードとインストールに同意するかどうかを尋ねます。通常、インストールプロセスを開始するには、プロンプトに「yes」または「y」という単語を入力する必要があります。プロンプトを回避するには、コマンドpkg –y install nginx-fullのように–yフラグを追加します。

root@ik1-438-51137:~ # pkg install nginx-full
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 72 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        ImageMagick6: 6.9.12.12,1
        alsa-lib: 1.2.2
        aom: 3.1.1
        argp-standalone: 1.3_4
        brotli: 1.0.9,1
        cairo: 1.17.4,3
        dav1d: 0.9.0
        dejavu: 2.37_1
        encodings: 1.0.5,1
        ffmpeg: 4.4_2,1
        font-bh-ttf: 1.0.3_4
        font-misc-ethiopic: 1.0.4
        font-misc-meltho: 1.0.3_4
        gdk-pixbuf2: 2.40.0
        ghostscript9-agpl-x11: 9.52
        google-perftools: 2.9.1_1
        java-zoneinfo: 2021.a
        javavmwrapper: 2.7.7
        lame: 3.100_3
        libXext: 1.3.4,1
        libXfixes: 5.0.3_2
        libXft: 2.3.3
        libXi: 1.7.10,1
        libXrender: 0.9.10_2
        libXt: 1.2.1,1
        libXtst: 1.2.3_2
        libass: 0.15.1
        libdrizzle: 0.8_7
        libdrm: 2.4.106,1
        libepoll-shim: 0.0.20210418
        libfontenc: 1.1.4
        libgcrypt: 1.9.3
        libglvnd: 1.3.3
        libgpg-error: 1.42
        libgsf: 1.14.47_1
        libinotify: 20180201_2
        libmaxminddb: 1.6.0
        libogg: 1.3.5,4
        libpciaccess: 0.16
        librsvg2-rust: 2.50.3_4
        libtheora: 1.1.1_7
        libudev-devd: 0.4.2_1
        libunwind: 20201110
        libv4l: 1.20.0_2
        libva: 2.12.0
        libvdpau: 1.4
        libvorbis: 1.3.7_2,3
        libvpx: 1.10.0
        libwmf: 0.2.12
        libx264: 0.163.3060
        libxslt: 1.1.34_2
        libyaml: 0.2.5
        lua-resty-core: 0.1.21_1
        lua-resty-lrucache: 0.10
        luajit-openresty: 2.1.20210510
        mkfontscale: 1.2.1
        msgpuck: 2.0_3
        nginx-full: 1.20.1_6,2
        openjdk8: 8.292.10.1
        openldap-client: 2.4.59
        opus: 1.3.1
        pango: 1.48.4_1
        pciids: 20210516
        pixman: 0.40.0_1
        postgresql12-client: 12.7
        ruby: 2.7.3_2,1
        shared-mime-info: 2.0
        wayland: 1.19.0_1
        x265: 3.4_1
        xorg-fonts-truetype: 7.7_1
        xvid: 1.3.7,1
        yajl: 2.1.0

Number of packages to be installed: 72

The process will require 537 MiB more space.
147 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/72] Fetching nginx-full-1.20.1_6,2.txz: 100%    9 MiB   4.8MB/s    00:02
[2/72] Fetching lua-resty-core-0.1.21_1.txz: 100%   26 KiB  26.7kB/s    00:01
[3/72] Fetching lua-resty-lrucache-0.10.txz: 100%    7 KiB   7.6kB/s    00:01
[4/72] Fetching luajit-openresty-2.1.20210510.txz: 100%    2 MiB   1.8MB/s    00:01
[5/72] Fetching libxslt-1.1.34_2.txz: 100%  232 KiB 238.0kB/s    00:01
[6/72] Fetching libwmf-0.2.12.txz: 100%    2 MiB   2.2MB/s    00:01
[7/72] Fetching ImageMagick6-6.9.12.12,1.txz: 100%    8 MiB   3.9MB/s    00:02
[8/72] Fetching libXext-1.3.4,1.txz: 100%   95 KiB  97.0kB/s    00:01
[9/72] Fetching pango-1.48.4_1.txz: 100%    1 MiB   1.5MB/s    00:01
[10/72] Fetching libXrender-0.9.10_2.txz: 100%   29 KiB  29.7kB/s    00:01
[11/72] Fetching xorg-fonts-truetype-7.7_1.txz: 100%    508 B   0.5kB/s    00:01
[12/72] Fetching font-misc-meltho-1.0.3_4.txz: 100%  719 KiB 735.8kB/s    00:01
[13/72] Fetching mkfontscale-1.2.1.txz: 100%   21 KiB  21.4kB/s    00:01
[14/72] Fetching libfontenc-1.1.4.txz: 100%   19 KiB  19.9kB/s    00:01
[15/72] Fetching font-misc-ethiopic-1.0.4.txz: 100%  127 KiB 130.2kB/s    00:01
[16/72] Fetching font-bh-ttf-1.0.3_4.txz: 100%  268 KiB 274.8kB/s    00:01
[17/72] Fetching encodings-1.0.5,1.txz: 100%  558 KiB 571.3kB/s    00:01
[18/72] Fetching dejavu-2.37_1.txz: 100%    2 MiB   2.5MB/s    00:01
[19/72] Fetching libXft-2.3.3.txz: 100%   64 KiB  65.7kB/s    00:01
[20/72] Fetching cairo-1.17.4,3.txz: 100%    1 MiB   1.1MB/s    00:01
[21/72] Fetching pixman-0.40.0_1.txz: 100%  324 KiB 331.6kB/s    00:01
[22/72] Fetching libglvnd-1.3.3.txz: 100%  339 KiB 347.0kB/s    00:01
[23/72] Fetching libXfixes-5.0.3_2.txz: 100%   15 KiB  15.2kB/s    00:01
[24/72] Fetching wayland-1.19.0_1.txz: 100%  120 KiB 123.0kB/s    00:01
[25/72] Fetching libepoll-shim-0.0.20210418.txz: 100%   23 KiB  23.7kB/s    00:01
[26/72] Fetching libdrm-2.4.106,1.txz: 100%  230 KiB 235.2kB/s    00:01
[27/72] Fetching libpciaccess-0.16.txz: 100%   22 KiB  22.2kB/s    00:01
[28/72] Fetching pciids-20210516.txz: 100%  220 KiB 224.8kB/s    00:01
[29/72] Fetching libunwind-20201110.txz: 100%  128 KiB 130.6kB/s    00:01
[30/72] Fetching libudev-devd-0.4.2_1.txz: 100%   14 KiB  14.8kB/s    00:01
[31/72] Fetching libXt-1.2.1,1.txz: 100%  449 KiB 459.4kB/s    00:01
[32/72] Fetching ghostscript9-agpl-x11-9.52.txz: 100%   28 KiB  28.3kB/s    00:01
[33/72] Fetching librsvg2-rust-2.50.3_4.txz: 100%    2 MiB   2.4MB/s    00:01
[34/72] Fetching gdk-pixbuf2-2.40.0.txz: 100%  510 KiB 521.9kB/s    00:01
[35/72] Fetching shared-mime-info-2.0.txz: 100%  503 KiB 515.1kB/s    00:01
[36/72] Fetching libgsf-1.14.47_1.txz: 100%  374 KiB 382.6kB/s    00:01
[37/72] Fetching libgpg-error-1.42.txz: 100%  296 KiB 303.5kB/s    00:01
[38/72] Fetching libgcrypt-1.9.3.txz: 100%  840 KiB 860.4kB/s    00:01
[39/72] Fetching openldap-client-2.4.59.txz: 100%    1 MiB   1.1MB/s    00:01
[40/72] Fetching libmaxminddb-1.6.0.txz: 100%   36 KiB  36.7kB/s    00:01
[41/72] Fetching ffmpeg-4.4_2,1.txz: 100%    9 MiB   9.9MB/s    00:01
[42/72] Fetching xvid-1.3.7,1.txz: 100%  283 KiB 289.5kB/s    00:01
[43/72] Fetching x265-3.4_1.txz: 100%    2 MiB   1.9MB/s    00:01
[44/72] Fetching libx264-0.163.3060.txz: 100%  677 KiB 693.7kB/s    00:01
[45/72] Fetching libvpx-1.10.0.txz: 100%    1 MiB   1.3MB/s    00:01
[46/72] Fetching libvdpau-1.4.txz: 100%   56 KiB  57.5kB/s    00:01
[47/72] Fetching libva-2.12.0.txz: 100%  162 KiB 165.7kB/s    00:01
[48/72] Fetching libv4l-1.20.0_2.txz: 100%  365 KiB 373.5kB/s    00:01
[49/72] Fetching argp-standalone-1.3_4.txz: 100%   33 KiB  33.7kB/s    00:01
[50/72] Fetching libtheora-1.1.1_7.txz: 100%  171 KiB 174.8kB/s    00:01
[51/72] Fetching libvorbis-1.3.7_2,3.txz: 100%  344 KiB 352.5kB/s    00:01
[52/72] Fetching libogg-1.3.5,4.txz: 100%  193 KiB 197.4kB/s    00:01
[53/72] Fetching libass-0.15.1.txz: 100%  140 KiB 143.7kB/s    00:01
[54/72] Fetching dav1d-0.9.0.txz: 100%  427 KiB 437.1kB/s    00:01
[55/72] Fetching aom-3.1.1.txz: 100%    3 MiB   3.5MB/s    00:01
[56/72] Fetching opus-1.3.1.txz: 100%  326 KiB 333.9kB/s    00:01
[57/72] Fetching lame-3.100_3.txz: 100%  359 KiB 367.6kB/s    00:01
[58/72] Fetching ruby-2.7.3_2,1.txz: 100%    8 MiB   4.1MB/s    00:02
[59/72] Fetching libyaml-0.2.5.txz: 100%   71 KiB  72.4kB/s    00:01
[60/72] Fetching openjdk8-8.292.10.1.txz: 100%   81 MiB  10.6MB/s    00:08
[61/72] Fetching libXtst-1.2.3_2.txz: 100%   20 KiB  20.1kB/s    00:01
[62/72] Fetching libXi-1.7.10,1.txz: 100%  121 KiB 124.4kB/s    00:01
[63/72] Fetching javavmwrapper-2.7.7.txz: 100%   16 KiB  16.7kB/s    00:01
[64/72] Fetching java-zoneinfo-2021.a.txz: 100%   72 KiB  73.7kB/s    00:01
[65/72] Fetching libinotify-20180201_2.txz: 100%   26 KiB  26.3kB/s    00:01
[66/72] Fetching alsa-lib-1.2.2.txz: 100%  445 KiB 455.4kB/s    00:01
[67/72] Fetching yajl-2.1.0.txz: 100%   58 KiB  59.5kB/s    00:01
[68/72] Fetching msgpuck-2.0_3.txz: 100%   30 KiB  31.2kB/s    00:01
[69/72] Fetching google-perftools-2.9.1_1.txz: 100%  700 KiB 716.6kB/s    00:01
[70/72] Fetching postgresql12-client-12.7.txz: 100%    3 MiB   2.7MB/s    00:01
[71/72] Fetching libdrizzle-0.8_7.txz: 100%   55 KiB  56.1kB/s    00:01
[72/72] Fetching brotli-1.0.9,1.txz: 100%  355 KiB 363.8kB/s    00:01
Checking integrity... done (4 conflicting)
  - libwmf-0.2.12 conflicts with libwmf-nox11-0.2.12 on /usr/local/bin/libwmf-config
  - libwmf-0.2.12 conflicts with libwmf-nox11-0.2.12 on /usr/local/bin/libwmf-config
  - ImageMagick6-6.9.12.12,1 conflicts with ImageMagick6-nox11-6.9.12.12,1 on /usr/local/bin/Magick++-config
  - ImageMagick6-6.9.12.12,1 conflicts with ImageMagick6-nox11-6.9.12.12,1 on /usr/local/bin/Magick++-config
Checking integrity... done (0 conflicting)
Conflicts with the existing packages have been found.
One more solver iteration is needed to resolve them.
The following 75 package(s) will be affected (of 0 checked):

Installed packages to be REMOVED:
        ImageMagick6-nox11: 6.9.12.12,1
        libwmf-nox11: 0.2.12
        php74-pecl-imagick: 3.4.4_2

New packages to be INSTALLED:
        ImageMagick6: 6.9.12.12,1
        alsa-lib: 1.2.2
        aom: 3.1.1
        argp-standalone: 1.3_4
        brotli: 1.0.9,1
        cairo: 1.17.4,3
        dav1d: 0.9.0
        dejavu: 2.37_1
        encodings: 1.0.5,1
        ffmpeg: 4.4_2,1
        font-bh-ttf: 1.0.3_4
        font-misc-ethiopic: 1.0.4
        font-misc-meltho: 1.0.3_4
        gdk-pixbuf2: 2.40.0
        ghostscript9-agpl-x11: 9.52
        google-perftools: 2.9.1_1
        java-zoneinfo: 2021.a
        javavmwrapper: 2.7.7
        lame: 3.100_3
        libXext: 1.3.4,1
        libXfixes: 5.0.3_2
        libXft: 2.3.3
        libXi: 1.7.10,1
        libXrender: 0.9.10_2
        libXt: 1.2.1,1
        libXtst: 1.2.3_2
        libass: 0.15.1
        libdrizzle: 0.8_7
        libdrm: 2.4.106,1
        libepoll-shim: 0.0.20210418
        libfontenc: 1.1.4
        libgcrypt: 1.9.3
        libglvnd: 1.3.3
        libgpg-error: 1.42
        libgsf: 1.14.47_1
        libinotify: 20180201_2
        libmaxminddb: 1.6.0
        libogg: 1.3.5,4
        libpciaccess: 0.16
        librsvg2-rust: 2.50.3_4
        libtheora: 1.1.1_7
        libudev-devd: 0.4.2_1
        libunwind: 20201110
        libv4l: 1.20.0_2
        libva: 2.12.0
        libvdpau: 1.4
        libvorbis: 1.3.7_2,3
        libvpx: 1.10.0
        libwmf: 0.2.12
        libx264: 0.163.3060
        libxslt: 1.1.34_2
        libyaml: 0.2.5
        lua-resty-core: 0.1.21_1
        lua-resty-lrucache: 0.10
        luajit-openresty: 2.1.20210510
        mkfontscale: 1.2.1
        msgpuck: 2.0_3
        nginx-full: 1.20.1_6,2
        openjdk8: 8.292.10.1
        openldap-client: 2.4.59
        opus: 1.3.1
        pango: 1.48.4_1
        pciids: 20210516
        pixman: 0.40.0_1
        postgresql12-client: 12.7
        ruby: 2.7.3_2,1
        shared-mime-info: 2.0
        wayland: 1.19.0_1
        x265: 3.4_1
        xorg-fonts-truetype: 7.7_1
        xvid: 1.3.7,1
        yajl: 2.1.0

Number of packages to be removed: 3
Number of packages to be installed: 72

The process will require 507 MiB more space.

Proceed with this action? [y/N]: y
[1/75] Deinstalling php74-pecl-imagick-3.4.4_2...
[1/75] Deleting files for php74-pecl-imagick-3.4.4_2: 100%
[2/75] Deinstalling ImageMagick6-nox11-6.9.12.12,1...
[2/75] Deleting files for ImageMagick6-nox11-6.9.12.12,1: 100%
[3/75] Deinstalling libwmf-nox11-0.2.12...
[3/75] Deleting files for libwmf-nox11-0.2.12: 100%
[4/75] Installing libfontenc-1.1.4...
[4/75] Extracting libfontenc-1.1.4: 100%
[5/75] Installing libXext-1.3.4,1...
[5/75] Extracting libXext-1.3.4,1: 100%
[6/75] Installing mkfontscale-1.2.1...
[6/75] Extracting mkfontscale-1.2.1: 100%
[7/75] Installing libXrender-0.9.10_2...
[7/75] Extracting libXrender-0.9.10_2: 100%
[8/75] Installing font-misc-meltho-1.0.3_4...
[8/75] Extracting font-misc-meltho-1.0.3_4: 100%
[9/75] Installing font-misc-ethiopic-1.0.4...
[9/75] Extracting font-misc-ethiopic-1.0.4: 100%
[10/75] Installing font-bh-ttf-1.0.3_4...
[10/75] Extracting font-bh-ttf-1.0.3_4: 100%
[11/75] Installing encodings-1.0.5,1...
[11/75] Extracting encodings-1.0.5,1: 100%
[12/75] Installing dejavu-2.37_1...
[12/75] Extracting dejavu-2.37_1: 100%
[13/75] Installing pixman-0.40.0_1...
[13/75] Extracting pixman-0.40.0_1: 100%
[14/75] Installing libglvnd-1.3.3...
[14/75] Extracting libglvnd-1.3.3: 100%
[15/75] Installing pciids-20210516...
[15/75] Extracting pciids-20210516: 100%
[16/75] Installing xorg-fonts-truetype-7.7_1...
[17/75] Installing libXft-2.3.3...
[17/75] Extracting libXft-2.3.3: 100%
[18/75] Installing cairo-1.17.4,3...
[18/75] Extracting cairo-1.17.4,3: 100%
[19/75] Installing libXfixes-5.0.3_2...
[19/75] Extracting libXfixes-5.0.3_2: 100%
[20/75] Installing libepoll-shim-0.0.20210418...
[20/75] Extracting libepoll-shim-0.0.20210418: 100%
[21/75] Installing libpciaccess-0.16...
[21/75] Extracting libpciaccess-0.16: 100%
[22/75] Installing shared-mime-info-2.0...
[22/75] Extracting shared-mime-info-2.0: 100%
[23/75] Installing libogg-1.3.5,4...
[23/75] Extracting libogg-1.3.5,4: 100%
[24/75] Installing luajit-openresty-2.1.20210510...
[24/75] Extracting luajit-openresty-2.1.20210510: 100%
[25/75] Installing pango-1.48.4_1...
[25/75] Extracting pango-1.48.4_1: 100%
[26/75] Installing wayland-1.19.0_1...
[26/75] Extracting wayland-1.19.0_1: 100%
[27/75] Installing libdrm-2.4.106,1...
[27/75] Extracting libdrm-2.4.106,1: 100%
[28/75] Installing libudev-devd-0.4.2_1...
[28/75] Extracting libudev-devd-0.4.2_1: 100%
[29/75] Installing libXt-1.2.1,1...
[29/75] Extracting libXt-1.2.1,1: 100%
[30/75] Installing gdk-pixbuf2-2.40.0...
[30/75] Extracting gdk-pixbuf2-2.40.0: 100%
[31/75] Installing libgpg-error-1.42...
[31/75] Extracting libgpg-error-1.42: 100%
[32/75] Installing argp-standalone-1.3_4...
[32/75] Extracting argp-standalone-1.3_4: 100%
[33/75] Installing libvorbis-1.3.7_2,3...
[33/75] Extracting libvorbis-1.3.7_2,3: 100%
[34/75] Installing libXi-1.7.10,1...
[34/75] Extracting libXi-1.7.10,1: 100%
[35/75] Installing lua-resty-lrucache-0.10...
[35/75] Extracting lua-resty-lrucache-0.10: 100%
[36/75] Installing libwmf-0.2.12...
[36/75] Extracting libwmf-0.2.12: 100%
[37/75] Installing libunwind-20201110...
[37/75] Extracting libunwind-20201110: 100%
[38/75] Installing ghostscript9-agpl-x11-9.52...
[38/75] Extracting ghostscript9-agpl-x11-9.52: 100%
[39/75] Installing librsvg2-rust-2.50.3_4...
[39/75] Extracting librsvg2-rust-2.50.3_4: 100%
[40/75] Installing libgsf-1.14.47_1...
[40/75] Extracting libgsf-1.14.47_1: 100%
[41/75] Installing libgcrypt-1.9.3...
[41/75] Extracting libgcrypt-1.9.3: 100%
[42/75] Installing xvid-1.3.7,1...
[42/75] Extracting xvid-1.3.7,1: 100%
[43/75] Installing x265-3.4_1...
[43/75] Extracting x265-3.4_1: 100%
[44/75] Installing libx264-0.163.3060...
[44/75] Extracting libx264-0.163.3060: 100%
[45/75] Installing libvpx-1.10.0...
[45/75] Extracting libvpx-1.10.0: 100%
[46/75] Installing libvdpau-1.4...
[46/75] Extracting libvdpau-1.4: 100%
[47/75] Installing libva-2.12.0...
[47/75] Extracting libva-2.12.0: 100%
[48/75] Installing libv4l-1.20.0_2...
[48/75] Extracting libv4l-1.20.0_2: 100%
[49/75] Installing libtheora-1.1.1_7...
[49/75] Extracting libtheora-1.1.1_7: 100%
[50/75] Installing libass-0.15.1...
[50/75] Extracting libass-0.15.1: 100%
[51/75] Installing dav1d-0.9.0...
[51/75] Extracting dav1d-0.9.0: 100%
[52/75] Installing aom-3.1.1...
[52/75] Extracting aom-3.1.1: 100%
[53/75] Installing opus-1.3.1...
[53/75] Extracting opus-1.3.1: 100%
[54/75] Installing lame-3.100_3...
[54/75] Extracting lame-3.100_3: 100%
[55/75] Installing libyaml-0.2.5...
[55/75] Extracting libyaml-0.2.5: 100%
[56/75] Installing libXtst-1.2.3_2...
[56/75] Extracting libXtst-1.2.3_2: 100%
[57/75] Installing javavmwrapper-2.7.7...
[57/75] Extracting javavmwrapper-2.7.7: 100%
[58/75] Installing java-zoneinfo-2021.a...
[58/75] Extracting java-zoneinfo-2021.a: 100%
[59/75] Installing libinotify-20180201_2...
[59/75] Extracting libinotify-20180201_2: 100%
[60/75] Installing alsa-lib-1.2.2...
[60/75] Extracting alsa-lib-1.2.2: 100%
[61/75] Installing lua-resty-core-0.1.21_1...
[61/75] Extracting lua-resty-core-0.1.21_1: 100%
[62/75] Installing libxslt-1.1.34_2...
[62/75] Extracting libxslt-1.1.34_2: 100%
[63/75] Installing ImageMagick6-6.9.12.12,1...
[63/75] Extracting ImageMagick6-6.9.12.12,1: 100%
[64/75] Installing openldap-client-2.4.59...
[64/75] Extracting openldap-client-2.4.59: 100%
[65/75] Installing libmaxminddb-1.6.0...
[65/75] Extracting libmaxminddb-1.6.0: 100%
[66/75] Installing ffmpeg-4.4_2,1...
[66/75] Extracting ffmpeg-4.4_2,1: 100%
[67/75] Installing ruby-2.7.3_2,1...
[67/75] Extracting ruby-2.7.3_2,1: 100%
[68/75] Installing openjdk8-8.292.10.1...
[68/75] Extracting openjdk8-8.292.10.1: 100%
[69/75] Installing yajl-2.1.0...
[69/75] Extracting yajl-2.1.0: 100%
[70/75] Installing msgpuck-2.0_3...
[70/75] Extracting msgpuck-2.0_3: 100%
[71/75] Installing google-perftools-2.9.1_1...
[71/75] Extracting google-perftools-2.9.1_1: 100%
[72/75] Installing postgresql12-client-12.7...
[72/75] Extracting postgresql12-client-12.7: 100%
[73/75] Installing libdrizzle-0.8_7...
[73/75] Extracting libdrizzle-0.8_7: 100%
[74/75] Installing brotli-1.0.9,1...
[74/75] Extracting brotli-1.0.9,1: 100%
[75/75] Installing nginx-full-1.20.1_6,2...
===> Creating groups.
Using existing group 'www'.
===> Creating users
Using existing user 'www'.
[75/75] Extracting nginx-full-1.20.1_6,2: 100%
=====
Message from dejavu-2.37_1:

--
Make sure that the freetype module is loaded.  If it is not, add the following
line to the "Modules" section of your X Windows configuration file:

        Load "freetype"

Add the following line to the "Files" section of X Windows configuration file:

        FontPath "/usr/local/share/fonts/dejavu/"

Note: your X Windows configuration file is typically /etc/X11/XF86Config
if you are using XFree86, and /etc/X11/xorg.conf if you are using X.Org.
=====
Message from wayland-1.19.0_1:

--
Wayland requires XDG_RUNTIME_DIR to be defined to a path that will
contain "wayland-%d" unix(4) sockets. This is usually handled by
consolekit2 (via ck-launch-session) or pam_xdg (via login).
=====
Message from argp-standalone-1.3_4:

--
===>   NOTICE:

The argp-standalone port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:

https://bugs.freebsd.org/bugzilla

More information about port maintainership is available at:

https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port
=====
Message from libwmf-0.2.12:

--
===>   NOTICE:

The libwmf port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:

https://bugs.freebsd.org/bugzilla

More information about port maintainership is available at:

https://docs.freebsd.org/en/articles/contributing/#ports-contributing
=====
Message from libinotify-20180201_2:

--
Libinotify functionality on FreeBSD is missing support for

  - detecting a file being moved into or out of a directory within the
    same filesystem
  - certain modifications to a symbolic link (rather than the
    file it points to.)

in addition to the known limitations on all platforms using kqueue(2)
where various open and close notifications are unimplemented.

This means the following regression tests will fail:

Directory notifications:
   IN_MOVED_FROM
   IN_MOVED_TO

Open/close notifications:
   IN_OPEN
   IN_CLOSE_NOWRITE
   IN_CLOSE_WRITE

Symbolic Link notifications:
   IN_DONT_FOLLOW
   IN_ATTRIB
   IN_MOVE_SELF
   IN_DELETE_SELF

Kernel patches to address the missing directory and symbolic link
notifications are available from:

https://github.com/libinotify-kqueue/libinotify-kqueue/tree/master/patches

You might want to consider increasing the kern.maxfiles tunable if you plan
to use this library for applications that need to monitor activity of a lot
of files.
=====
Message from alsa-lib-1.2.2:

--
===>   NOTICE:

The alsa-lib port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:

https://bugs.freebsd.org/bugzilla

More information about port maintainership is available at:

https://docs.freebsd.org/en/articles/contributing/#ports-contributing
=====
Message from openldap-client-2.4.59:

--
The OpenLDAP client package has been successfully installed.

Edit
  /usr/local/etc/openldap/ldap.conf
to change the system-wide client defaults.

Try `man ldap.conf' and visit the OpenLDAP FAQ-O-Matic at
  http://www.OpenLDAP.org/faq/index.cgi?file=3
for more information.
=====
Message from ruby-2.7.3_2,1:

--
Some of the standard commands are provided as separate ports for ease
of upgrading:

        devel/ruby-gems:                gem - RubyGems package manager
        devel/rubygem-irb:              irb - Interactive Ruby
        devel/rubygem-rake:             rake - Ruby Make
        devel/rubygem-rdoc:             rdoc - Ruby Documentation System
        sysutils/rubygem-bundler:       bundler - Tool that manages gem dependencies for ruby applications

And some of the standard libraries are provided as separate ports
since they require extra dependencies:

        databases/rubygem-dbm:  DBM module
        databases/rubygem-gdbm: GDBM module

Install them as occasion demands.
=====
Message from openjdk8-8.292.10.1:

--
This OpenJDK implementation requires fdescfs(5) mounted on /dev/fd and
procfs(5) mounted on /proc.

If you have not done it yet, please do the following:

        mount -t fdescfs fdesc /dev/fd
        mount -t procfs proc /proc

To make it permanent, you need the following lines in /etc/fstab:

        fdesc   /dev/fd         fdescfs         rw      0       0
        proc    /proc           procfs          rw      0       0
=====
Message from postgresql12-client-12.7:

--
The PostgreSQL port has a collection of "side orders":

postgresql-docs
  For all of the html documentation

p5-Pg
  A perl5 API for client access to PostgreSQL databases.

postgresql-tcltk
  If you want tcl/tk client support.

postgresql-jdbc
  For Java JDBC support.

postgresql-odbc
  For client access from unix applications using ODBC as access
  method. Not needed to access unix PostgreSQL servers from Win32
  using ODBC. See below.

ruby-postgres, py-psycopg2
  For client access to PostgreSQL databases using the ruby & python
  languages.

postgresql-plperl, postgresql-pltcl & postgresql-plruby
  For using perl5, tcl & ruby as procedural languages.

postgresql-contrib
  Lots of contributed utilities, postgresql functions and
  datatypes. There you find pg_standby, pgcrypto and many other cool
  things.

etc...
=====
Message from libdrizzle-0.8_7:

--
===>   NOTICE:

The libdrizzle port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:

https://bugs.freebsd.org/bugzilla

More information about port maintainership is available at:

https://docs.freebsd.org/en/articles/contributing/#ports-contributing
=====
Message from nginx-full-1.20.1_6,2:

--
Recent version of the NGINX introduces dynamic modules support.  In
FreeBSD ports tree this feature was enabled by default with the DSO
knob.  Several vendor's and third-party modules have been converted
to dynamic modules.  Unset the DSO knob builds an NGINX without
dynamic modules support.

To load a module at runtime, include the new `load_module'
directive in the main context, specifying the path to the shared
object file for the module, enclosed in quotation marks.  When you
reload the configuration or restart NGINX, the module is loaded in.
It is possible to specify a path relative to the source directory,
or a full path, please see
https://www.nginx.com/blog/dynamic-modules-nginx-1-9-11/ and
http://nginx.org/en/docs/ngx_core_module.html#load_module for
details.

Default path for the NGINX dynamic modules is

/usr/local/libexec/nginx.

インストールされたダイナミックモジュール
/usr/local/libexec/nginx」にダイナミックモジュールがインストールされます。

root@ik1-438-51137:~ # ls /usr/local/libexec/nginx
ndk_http_module.so ngx_http_h264_streaming_module.so ngx_http_slowfs_module.so
ngx_http_accept_language_module.so ngx_http_headers_more_filter_module.so ngx_http_small_light_module.so
ngx_http_array_var_module.so ngx_http_iconv_module.so ngx_http_srcache_filter_module.so
ngx_http_auth_digest_module.so ngx_http_image_filter_module.so ngx_http_ssl_ct_module.so
ngx_http_auth_ldap_module.so ngx_http_js_module.so ngx_http_sticky_module.so
ngx_http_auth_pam_module.so ngx_http_json_status_module.so ngx_http_subs_filter_module.so
ngx_http_auth_spnego_module.so ngx_http_let_module.so ngx_http_tnt_module.so
ngx_http_aws_auth_module.so ngx_http_lua_module.so ngx_http_upload_module.so
ngx_http_brotli_filter_module.so ngx_http_memc_module.so ngx_http_uploadprogress_module.so
ngx_http_brotli_static_module.so ngx_http_mogilefs_module.so ngx_http_upstream_fair_module.so
ngx_http_clojure_module.so ngx_http_naxsi_module.so ngx_http_video_thumbextractor_module.so
ngx_http_dav_ext_module.so ngx_http_notice_module.so ngx_http_xslt_filter_module.so
ngx_http_drizzle_module.so ngx_http_passenger_module.so ngx_http_xss_filter_module.so
ngx_http_dynamic_upstream_module.so ngx_http_perl_module.so ngx_http_zip_module.so
ngx_http_echo_module.so ngx_http_push_stream_module.so ngx_mail_module.so
ngx_http_encrypted_session_module.so ngx_http_rds_csv_filter_module.so ngx_nchan_module.so
ngx_http_eval_module.so ngx_http_rds_json_filter_module.so ngx_postgres_module.so
ngx_http_fancyindex_module.so ngx_http_redis_module.so ngx_rtmp_module.so
ngx_http_footer_filter_module.so ngx_http_redis2_module.so ngx_ssl_ct_module.so
ngx_http_form_input_module.so ngx_http_response_module.so ngx_stream_geoip2_module.so
ngx_http_geoip2_module.so ngx_http_set_misc_module.so ngx_stream_js_module.so
ngx_http_gridfs_module.so ngx_http_shibboleth_module.so ngx_stream_module.so

Nginxのインストールが完了したら、次はシステムでNginxを有効にします。
次のコマンドを実行して、/etc/rc.confに「nginx_enable=YES」を追加します。

root@ik1-438-51137:~ # sysrc nginx_enable=YES
nginx_enable:  -> YES

これでserviceコマンドが利用できるようになりました。
次のコマンドを実行してnginxデーモンを起動します。

root@ik1-438-51137:~ # service nginx start
Performing sanity check on nginx configuration:
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
Starting nginx.

システムでNginxサービスが開始されているかどうか、およびどのネットワークソケットでサービスがバインドされているかを確認するために、sockstatコマンドを実行します
通常、デフォルトでは*:80TCPソケットにバインドされます。 grepコマンドラインフィルターを使用して、nginxサーバーに一致するソケットのみを表示できます。

root@ik1-438-51137:~ # sockstat -46 | grep nginx
www      nginx      23953 10 tcp4   *:80                  *:*
www      nginx      23953 11 tcp6   *:80                  *:*

NginxのデフォルトのWebページにアクセスするには、ネットワーク内のコンピューターでブラウザーを開き、HTTPプロトコルを介してサーバーのIPアドレスに移動します。ドメイン名を登録した場合、または構内でローカルDNSサーバーを使用している場合は、マシンの完全修飾ドメイン名またはドメイン名を使用できます。
次のスクリーンショットに示すように、「nginxへようこそ!」というタイトルメッセージがいくつかのHTML行と一緒にブラウザに表示されていれば今の段階では正常です。

nginx

FreeBSD12.xでNginxのWebファイルが保存される場所は/usr/local/www/nginxディレクトリです。このディレクトリは、nginx-distディレクトリへのシンボリックリンクです。
Webサイトを展開するには、htmlまたはphpスクリプトファイルをこのディレクトリにコピーします。 Nginxのデフォルトのwebrootディレクトリを変更するには、/usr/local/etc/nginxディレクトリからNginx構成ファイル(nginx.conf)を開き、次の例に示すようにrootステートメントの行を更新します。

root@ik1-438-51137:~ # vi /usr/local/etc/nginx/nginx.conf

root       /usr/local/www/wordpress;

複数ドメインへの対応

複数ドメインでサイトを運営するためにバーチャルサーバーごとの構成ファイルを/usr/local/etc/nginx/conf.dに配置し、有効な設定と無効な設定を使い分けたいのでsites-enabledというディレクトリをさらに作成し、ここにconf.dへのソフトリンクを作成した設定だけがNginx Webサーバーで読み込まれるように変更します。

次のコマンドを実行します。
includeはhttpディレクティブ内の最終行に挿入します。

root@ik1-438-51137:~ # mkdir -p /usr/local/etc/nginx/conf.d
root@ik1-438-51137:~ # mkdir -p /usr/local/etc/nginx/sites-enabled
root@ik1-438-51137:~ # vi /usr/local/etc/nginx/nginx.conf
    ## Include all vhosts.
    include /usr/local/etc/nginx/sites-enabled/*;

バーチャルサーバーなどサーバーごとの構成ファイルは/usr/local/etc/nginx/conf.dに作成します。
このファイルにはserverディレクティブを記述します。
構成ファイルの作成・検証が終わり実運用したい構成ファイルはsites-enabledにリンクを作成します。
CentOSでもこの方法で運用していました。

Step 2.Install MariaDB Database

Webサーバーでダイナミックページ(動的ページ)を生成するにはデーターベースは必須の存在です。
MariaDBはNginxやApacheなどのWebサーバーと組み合わせて利用される人気のあるリレーショナルデータベースの1つです。
MariaDBは、PortsコレクションとPakagesとで提供されるバージョンは同じでした。
次のコマンドを実行して確認しました。

root@ik1-438-51137:~ # ls -al /usr/ports/databases/ | grep mariadb
drwxr-xr-x 3 root wheel 512 8月 1 22:19 mariadb-connector-c
drwxr-xr-x 2 root wheel 512 8月 1 22:19 mariadb-connector-odbc
drwxr-xr-x 3 root wheel 512 8月 1 22:19 mariadb103-client
drwxr-xr-x 3 root wheel 512 8月 13 23:41 mariadb103-server
drwxr-xr-x 2 root wheel 512 8月 1 22:19 mariadb104-client
drwxr-xr-x 3 root wheel 512 8月 13 23:41 mariadb104-server
drwxr-xr-x 2 root wheel 512 8月 14 00:16 mariadb105-client
drwxr-xr-x 3 root wheel 512 8月 14 00:29 mariadb105-server

root@ik1-438-51137:~ # pkg search mariadb
mariadb-connector-c-3.1.10     MariaDB database connector for C
mariadb-connector-odbc-3.1.11  MariaDB database connector for odbc
mariadb103-client-10.3.30      Multithreaded SQL database (client)
mariadb103-server-10.3.30      Multithreaded SQL database (server)
mariadb104-client-10.4.20      Multithreaded SQL database (client)
mariadb104-server-10.4.20      Multithreaded SQL database (server)
mariadb105-client-10.5.11      Multithreaded SQL database (client)
mariadb105-server-10.5.11      Multithreaded SQL database (server)
p5-DBD-MariaDB-1.21            MariaDB driver for the Perl5 Database Interface (DBI)
rubygem-azure_mgmt_mariadb-0.17.4 Microsoft Azure Microsoft Azure MariaDB Library for Ruby Client Library for Ruby

今回は、Pakagesバイナリーをインストールすることにしました。
次のコマンドを実行し、MariaDBデータベースサーバーとクライアントの最新リリースをインストールしました。

root@ik1-438-51137:~ # pkg install mariadb105-client mariadb105-server
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 10 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        bash: 5.1.8
        boost-libs: 1.72.0_5
        galera26: 26.4.8_1
        liblz4: 1.9.3,1
        mariadb105-client: 10.5.11
        mariadb105-server: 10.5.11
        rsync: 3.2.3_1
        unixODBC: 2.3.9
        xxhash: 0.8.0
        zstd: 1.5.0

Number of packages to be installed: 10

The process will require 420 MiB more space.
46 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/10] Fetching mariadb105-client-10.5.11.txz: 100%    2 MiB   1.7MB/s    00:01
[2/10] Fetching mariadb105-server-10.5.11.txz: 100%   28 MiB   7.2MB/s    00:04
[3/10] Fetching zstd-1.5.0.txz: 100%  579 KiB 592.6kB/s    00:01
[4/10] Fetching liblz4-1.9.3,1.txz: 100%  131 KiB 133.7kB/s    00:01
[5/10] Fetching bash-5.1.8.txz: 100%    1 MiB   1.5MB/s    00:01
[6/10] Fetching rsync-3.2.3_1.txz: 100%  355 KiB 363.1kB/s    00:01
[7/10] Fetching xxhash-0.8.0.txz: 100%   73 KiB  74.8kB/s    00:01
[8/10] Fetching unixODBC-2.3.9.txz: 100%  464 KiB 475.3kB/s    00:01
[9/10] Fetching galera26-26.4.8_1.txz: 100%  837 KiB 857.0kB/s    00:01
[10/10] Fetching boost-libs-1.72.0_5.txz: 100%   12 MiB  13.1MB/s    00:01
Checking integrity... done (0 conflicting)
[1/10] Installing liblz4-1.9.3,1...
[1/10] Extracting liblz4-1.9.3,1: 100%
[2/10] Installing zstd-1.5.0...
[2/10] Extracting zstd-1.5.0: 100%
[3/10] Installing xxhash-0.8.0...
[3/10] Extracting xxhash-0.8.0: 100%
[4/10] Installing boost-libs-1.72.0_5...
[4/10] Extracting boost-libs-1.72.0_5: 100%
[5/10] Installing mariadb105-client-10.5.11...
===> Creating groups.
Creating group 'mysql' with gid '88'.
===> Creating users
Creating user 'mysql' with uid '88'.
===> Creating homedir(s)
[5/10] Extracting mariadb105-client-10.5.11: 100%
[6/10] Installing bash-5.1.8...
[6/10] Extracting bash-5.1.8: 100%
[7/10] Installing rsync-3.2.3_1...
[7/10] Extracting rsync-3.2.3_1: 100%
[8/10] Installing unixODBC-2.3.9...
[8/10] Extracting unixODBC-2.3.9: 100%
[9/10] Installing galera26-26.4.8_1...
[9/10] Extracting galera26-26.4.8_1: 100%
[10/10] Installing mariadb105-server-10.5.11...
===> Creating groups.
Using existing group 'mysql'.
===> Creating users
Using existing user 'mysql'.
===> Creating homedir(s)
[10/10] Extracting mariadb105-server-10.5.11: 100%
=====
Message from boost-libs-1.72.0_5:

--
You have built the Boost library with thread support.

Don't forget to add -pthread to your linker options when
linking your code.
=====
Message from mariadb105-client-10.5.11:

--
MariaDB respects hier(7) and doesn't check /etc and /etc/mysql for
my.cnf. Please move existing my.cnf files from those paths to
/usr/local/etc/mysql or /usr/local/etc. Sample
configuration files are provided in /usr/local/etc/mysql
and /usr/local/etc/mysql/conf.d.
The rc(8) script no longer uses /var/db/mysql/my.cnf for configuration
nor /var/db/mysql for logs and PID-file.

This port does NOT include the mytop perl script, this is included in
the MariaDB tarball but the most recent version can be found in the
databases/mytop port
=====
Message from galera26-26.4.8_1:

--
Find the Galera Cluster documentation at
http://galeracluster.com/documentation-webpages/
=====
Message from mariadb105-server-10.5.11:

--
MariaDB respects hier(7) and doesn't check /etc and /etc/mysql for
my.cnf. Please move existing my.cnf files from those paths to
/usr/local/etc/mysql or /usr/local/etc. Sample
configuration files are provided in /usr/local/etc/mysql
and /usr/local/etc/mysql/conf.d.
The rc(8) script no longer uses /var/db/mysql/my.cnf for configuration
nor /var/db/mysql for logs and PID-file.

This port does NOT include the mytop perl script, this is included in
the MariaDB tarball but the most recent version can be found in the
databases/mytop port

MariaDBのインストールが完了したら、次はシステムでMySQL Serverを有効にします。
次のコマンドを実行し、/etc/rc.confに「mysql_enable=YES」を追加します。

root@ik1-438-51137:~ # sysrc mysql_enable=YES
nginx_enable:  -> YES

これで、serviceコマンドが利用できるようになりました。
次のコマンドを実行し、MySQL Serverのmariadbdデーモンを起動します。

root@ik1-438-51137:~ # service mysql-server start
Installing MariaDB/MySQL system tables in '/var/db/mysql' ...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system


Two all-privilege accounts were created.
One is root@localhost, it has no password, but you need to
be system 'root' user to connect. Use, for example, sudo mysql
The second is mysql@localhost, it has no password either, but
you need to be the system 'mysql' user to connect.
After connecting you can set the password, if you would need to be
able to connect as any of these users with a password and without sudo

See the MariaDB Knowledgebase at https://mariadb.com/kb or the
MySQL manual for more instructions.

You can start the MariaDB daemon with:
cd '/usr/local' ; /usr/local/bin/mysqld_safe --datadir='/var/db/mysql'

You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/local/mysql-test' ; perl mysql-test-run.pl

Please report any problems at https://mariadb.org/jira

The latest information about MariaDB is available at https://mariadb.org/.
You can find additional information about the MySQL part at:
https://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
Get Involved

Starting mysql.

MariaDBデータベースを保護

次にmysql_secure_installationスクリプトを実行してMariaDBデータベースを保護します。

スクリプト内での質問の目的はMySQLエンジンに一定レベルのセキュリティを提供することです。

  • MySQL rootユーザーのrootパスワードの設定
  • 匿名ユーザーの削除
  • rootユーザーのリモートログインの無効化
  • テストデータベースの削除など

MySQL rootユーザーの強力なパスワードを選択した後、通常は、すべての質問に「はい」と答えればよいでしょう。

root@ik1-438-51137:~ # mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n]
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n]
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

念のためrootでのログインテストを実施します。

root@ik1-438-51137:~ # mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 76272
Server version: 10.5.11-MariaDB FreeBSD Ports

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]> quit;
Bye

「Your MariaDB connection」とあればrootのログインに成功しています。

mysqlはSQLコマンドを実行するCUIです。SQLコマンドの最後には必ず「;(セミコロン)」を入力してください。

MySQL データーベースの設定

MySQLサーバーおよびクライアントの設定を変更するには/usr/local/etc/mysql/conf.dにあるそれぞれのファイルを編集します。

utf8mb4にすると絵文字や顔文字など補助文字だけでなくサロゲート文字など4バイト使用する文字が文字化けせずに扱えるようになるはずです。

次の設定では、主設定はデフォルトのまま文字コードを「utf8mb4」にしています。

server.cnf

[mysqld]
user                            = mysql
# port                          = 3306 # inherited from /usr/local/etc/mysql/my.cnf
# socket                        = /var/run/mysql/mysql.sock # inherited from /usr/local/etc/mysql/my.cnf
bind-address                    = 127.0.0.1
basedir                         = /usr/local
datadir                         = /var/db/mysql
net_retry_count                 = 16384
log_error                       = /var/log/mysql/mysqld.err
# [mysqld] configuration for ZFS
# From https://www.percona.com/resources/technical-presentations/zfs-mysql-percona-technical-webinar
# Create separate datasets for data and logs, eg
# zroot/mysql      compression=on recordsize=128k atime=off
# zroot/mysql/data recordsize=16k
# zroot/mysql/logs
# datadir                       = /var/db/mysql/data
# innodb_log_group_home_dir     = /var/db/mysql/log
# audit_log_file                = /var/db/mysql/log/audit.log
# general_log_file              = /var/db/mysql/log/general.log
# log_bin                       = /var/db/mysql/log/mysql-bin
# relay_log                     = /var/db/mysql/log/relay-log
# slow_query_log_file           = /var/db/mysql/log/slow.log
# innodb_doublewrite            = 0
# innodb_flush_method           = O_DSYNC

character-set-server=utf8mb4

client.cnf

[client]
# port                  = 3306 # inherited from /usr/local/etc/mysql/my.cnf
# socket                = /var/run/mysql/mysql.sock # inherited from /usr/local/etc/mysql/my.cnf
default-character-set = utf8mb4

設定を変更したら以下のコマンドでmariadbdデーモンを再起動し、設定変更内容を反映します。

root@ik1-438-51137:~ # service mysql-server restart
Stopping mysql.
Waiting for PIDS: 1114.
Starting mysql.

文字コードの確認

文字コードをutf8mb4に変更したので念のためその確認を行います。

root@ik1-438-51137:~ # mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 10.5.12-MariaDB FreeBSD Ports

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@localhost [(none)]> show variables like "char%";
+--------------------------+----------------------------------+
| Variable_name            | Value                            |
+--------------------------+----------------------------------+
| character_set_client     | utf8mb4                          |
| character_set_connection | utf8mb4                          |
| character_set_database   | utf8mb4                          |
| character_set_filesystem | binary                           |
| character_set_results    | utf8mb4                          |
| character_set_server     | utf8mb4                          |
| character_set_system     | utf8                             |
| character_sets_dir       | /usr/local/share/mysql/charsets/ |
+--------------------------+----------------------------------+
8 rows in set (0.001 sec)
root@localhost [(none)]> quit;
Bye

以上のような結果になれば正しく変更されています。

ネットワークソケットの確認

次のコマンドを実行し、localhost:3306ソケットでのみネットワーク接続をlistenしていることを確認します。

root@ik1-438-51137:~ # sockstat -46 | grep mysql
mysql    mariadbd   23439 36 tcp4   127.0.0.1:3306        *:*

セキュリティの観点からMariaDBへのリモートネットワーク接続を完全に無効にするには、/etc/rc.confファイルに「mysql_args=”–bind-address=127.0.0.1″」を追加するか、server.cnfに「bind-address = 127.0.0.1」を設定します。これにより、mysqlネットワークソケットをループバックインターフェイスにバインドするように強制することができます。

Step 3.Install PHP Programming Language

デフォルトでは、Nginx WebサーバーはPHPスクリプトを直接解析できません。そのため、Nginx Webサーバーは、FastCGIゲートウェイを介してPHPスクリプトを解釈して実行するPHP-FPMサーバーにPHPコードを渡す必要があります。 PHP-FPMサーバーをFreeBSDにインストールするには、以下のコマンドを発行して、利用可能なPHPプリコンパイル済みバイナリパッケージを検索します。

root@ik1-438-51137:~ # ls /usr/ports/lang/ | grep php
php-mode.el
php73
php73-extensions
php74
php74-extensions
php80
php80-extensions

2021年8月18日現在 MovableTypeではPHP7.4.Xまで動作検証済み、Wordpressは7.4以上を推奨。

FreeBSD Portsリポジトリで利用可能な多数のPHPバージョンから、最新バージョンのPHPインタープリター(現在はPHP 7.4リリース)をインストールすることを選択します。
次のコマンドを実行して、php74パッケージをインストールします。

root@ik1-438-51137:~ # pkg install php74
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (0 conflicting)
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        php74: 7.4.22

Number of packages to be installed: 1

The process will require 28 MiB more space.

Proceed with this action? [y/N]: y
[1/1] Installing php74-7.4.22...
[1/1] Extracting php74-7.4.22: 100%

必要に応じてPHP拡張モジュールをインストールします。

WordPressで推奨しているPHP拡張モジュールは次の通りです。

WordPress core makes use of PHP extensions. If the preferred extension is missing WordPress will either have to do more work to do the task the module helps with or, in the worst case, will remove functionality. Therefore the PHP extensions listed below are recommended.

curl – Performs remote request operations.
dom – Used to validate Text Widget content and to automatically configure IIS7+.
exif – Works with metadata stored in images.
fileinfo – Used to detect mimetype of file uploads.
hash – Used for hashing, including passwords and update packages.
imagick – Provides better image quality for media uploads. See WP_Image_Editor for details. Smarter image resizing (for smaller images) and PDF thumbnail support, when Ghost Script is also available.
json – Used for communications with other servers.
mbstring – Used to properly handle UTF8 text.
mysqli – Connects to MySQL for database interactions.
openssl – Permits SSL-based connections to other hosts.
pcre – Increases performance of pattern matching in code searches.
sodium – Validates Signatures and provides securely random bytes.
xml – Used for XML parsing, such as from a third-party site.
zip – Used for decompressing Plugins, Themes, and WordPress update packages.
For the sake of completeness, below is a list of the remaining PHP modules WordPress may use in certain situations or if other modules are unavailable. These are fallbacks or optional and not necessarily needed in an optimal environment, but installing them won’t hurt.

bcmath – For arbitrary precision mathematics, which supports numbers of any size and precision up to 2147483647 decimal digits.
filter – Used for securely filtering user input.
gd – If Imagick isn’t installed, the GD Graphics Library is used as a functionally limited fallback for image manipulation.
iconv – Used to convert between character sets.
intl – Enable to perform locale-aware operations including but not limited to formatting, transliteration, encoding conversion, calendar operations, conformant collation, locating text boundaries and working with locale identifiers, timezones and graphemes.
mcrypt – Generates random bytes when libsodium and /dev/urandom aren’t available.
simplexml – Used for XML parsing.
xmlreader – Used for XML parsing.
zlib – Gzip compression and decompression.
These extensions are used for file changes, such as updates and plugin/theme installation, when files aren’t writeable on the server.

ssh2 – Provide access to resources (shell, remote exec, tunneling, file transfer) on a remote machine using a secure cryptographic transport.
ftp – Implement client access to files servers speaking the File Transfer Protocol (FTP).
sockets – Implements a low-level interface to the socket communication functions based on the popular BSD sockets.
The priority of the transports are Direct file IO, SSH2, FTP PHP Extension, FTP implemented with Sockets, and FTP implemented through PHP alone.

Server Environment

追加するプラグインによっては、追加で必要になります。

Nextcloudで要求されるPHP拡張モジュールは次の通りです。

Required:

PHP (7.3 or 7.4)
PHP module ctype
PHP module curl
PHP module dom
PHP module filter (only on Mageia and FreeBSD)
PHP module GD
PHP module hash (only on FreeBSD)
PHP module iconv
PHP module JSON
PHP module libxml (Linux package libxml2 must be >=2.7.0)
PHP module mbstring
PHP module openssl
PHP module posix
PHP module session
PHP module SimpleXML
PHP module XMLReader
PHP module XMLWriter
PHP module zip
PHP module zlib

Prerequisites for manual installation

まず、php74-extensionsパッケージをインストールし、それでも不足しているモジュールを個別にインストールすることにしました。
次のコマンドを実行して、php74-extensionsパッケージをインストールします。

root@ik1-438-51137:~ # pkg install php74-extensions
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 21 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        libedit: 3.1.20210216,1
        libiconv: 1.16
        php74-ctype: 7.4.22
        php74-dom: 7.4.22
        php74-extensions: 1.0
        php74-filter: 7.4.22
        php74-iconv: 7.4.22
        php74-json: 7.4.22
        php74-opcache: 7.4.22
        php74-pdo: 7.4.22
        php74-pdo_sqlite: 7.4.22
        php74-phar: 7.4.22
        php74-posix: 7.4.22
        php74-session: 7.4.22
        php74-simplexml: 7.4.22
        php74-sqlite3: 7.4.22
        php74-tokenizer: 7.4.22
        php74-xml: 7.4.22
        php74-xmlreader: 7.4.22
        php74-xmlwriter: 7.4.22
        sqlite3: 3.35.5_3,1

Number of packages to be installed: 21

The process will require 9 MiB more space.
3 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/21] Fetching php74-extensions-1.0.txz: 100%    1 KiB   1.1kB/s    00:01
[2/21] Fetching php74-session-7.4.22.txz: 100%   34 KiB  35.0kB/s    00:01
[3/21] Fetching php74-opcache-7.4.22.txz: 100%  201 KiB 206.1kB/s    00:01
[4/21] Fetching php74-xmlwriter-7.4.22.txz: 100%   13 KiB  12.9kB/s    00:01
[5/21] Fetching php74-xmlreader-7.4.22.txz: 100%   12 KiB  12.5kB/s    00:01
[6/21] Fetching php74-dom-7.4.22.txz: 100%   54 KiB  55.2kB/s    00:01
[7/21] Fetching php74-xml-7.4.22.txz: 100%   19 KiB  19.7kB/s    00:01
[8/21] Fetching php74-simplexml-7.4.22.txz: 100%   23 KiB  23.2kB/s    00:01
[9/21] Fetching php74-ctype-7.4.22.txz: 100%    6 KiB   6.2kB/s    00:01
[10/21] Fetching php74-posix-7.4.22.txz: 100%   12 KiB  12.3kB/s    00:01
[11/21] Fetching php74-filter-7.4.22.txz: 100%   20 KiB  20.0kB/s    00:01
[12/21] Fetching php74-tokenizer-7.4.22.txz: 100%    9 KiB   9.2kB/s    00:01
[13/21] Fetching php74-json-7.4.22.txz: 100%   21 KiB  21.4kB/s    00:01
[14/21] Fetching php74-sqlite3-7.4.22.txz: 100%   19 KiB  19.7kB/s    00:01
[15/21] Fetching sqlite3-3.35.5_3,1.txz: 100%    1 MiB   1.3MB/s    00:01
[16/21] Fetching libedit-3.1.20210216,1.txz: 100%  136 KiB 138.8kB/s    00:01
[17/21] Fetching php74-pdo_sqlite-7.4.22.txz: 100%   13 KiB  13.0kB/s    00:01
[18/21] Fetching php74-pdo-7.4.22.txz: 100%   45 KiB  46.4kB/s    00:01
[19/21] Fetching php74-iconv-7.4.22.txz: 100%   17 KiB  17.9kB/s    00:01
[20/21] Fetching libiconv-1.16.txz: 100%  610 KiB 624.8kB/s    00:01
[21/21] Fetching php74-phar-7.4.22.txz: 100%  104 KiB 106.1kB/s    00:01
Checking integrity... done (0 conflicting)
[1/21] Installing libedit-3.1.20210216,1...
[1/21] Extracting libedit-3.1.20210216,1: 100%
[2/21] Installing php74-dom-7.4.22...
[2/21] Extracting php74-dom-7.4.22: 100%
[3/21] Installing sqlite3-3.35.5_3,1...
[3/21] Extracting sqlite3-3.35.5_3,1: 100%
[4/21] Installing php74-pdo-7.4.22...
[4/21] Extracting php74-pdo-7.4.22: 100%
[5/21] Installing libiconv-1.16...
[5/21] Extracting libiconv-1.16: 100%
[6/21] Installing php74-session-7.4.22...
[6/21] Extracting php74-session-7.4.22: 100%
[7/21] Installing php74-opcache-7.4.22...
[7/21] Extracting php74-opcache-7.4.22: 100%
[8/21] Installing php74-xmlwriter-7.4.22...
[8/21] Extracting php74-xmlwriter-7.4.22: 100%
[9/21] Installing php74-xmlreader-7.4.22...
[9/21] Extracting php74-xmlreader-7.4.22: 100%
[10/21] Installing php74-xml-7.4.22...
[10/21] Extracting php74-xml-7.4.22: 100%
[11/21] Installing php74-simplexml-7.4.22...
[11/21] Extracting php74-simplexml-7.4.22: 100%
[12/21] Installing php74-ctype-7.4.22...
[12/21] Extracting php74-ctype-7.4.22: 100%
[13/21] Installing php74-posix-7.4.22...
[13/21] Extracting php74-posix-7.4.22: 100%
[14/21] Installing php74-filter-7.4.22...
[14/21] Extracting php74-filter-7.4.22: 100%
[15/21] Installing php74-tokenizer-7.4.22...
[15/21] Extracting php74-tokenizer-7.4.22: 100%
[16/21] Installing php74-json-7.4.22...
[16/21] Extracting php74-json-7.4.22: 100%
[17/21] Installing php74-sqlite3-7.4.22...
[17/21] Extracting php74-sqlite3-7.4.22: 100%
[18/21] Installing php74-pdo_sqlite-7.4.22...
[18/21] Extracting php74-pdo_sqlite-7.4.22: 100%
[19/21] Installing php74-iconv-7.4.22...
[19/21] Extracting php74-iconv-7.4.22: 100%
[20/21] Installing php74-phar-7.4.22...
[20/21] Extracting php74-phar-7.4.22: 100%
[21/21] Installing php74-extensions-1.0...
=====
Message from php74-dom-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-dom.ini
=====
Message from php74-pdo-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-pdo.ini
=====
Message from php74-session-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-18-session.ini
=====
Message from php74-opcache-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-10-opcache.ini
=====
Message from php74-xmlwriter-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-xmlwriter.ini
=====
Message from php74-xmlreader-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-30-xmlreader.ini
=====
Message from php74-xml-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-xml.ini
=====
Message from php74-simplexml-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-simplexml.ini
=====
Message from php74-ctype-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-ctype.ini
=====
Message from php74-posix-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-posix.ini
=====
Message from php74-filter-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-filter.ini
=====
Message from php74-tokenizer-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-tokenizer.ini
=====
Message from php74-json-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-json.ini
=====
Message from php74-sqlite3-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-sqlite3.ini
=====
Message from php74-pdo_sqlite-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-30-pdo_sqlite.ini
=====
Message from php74-iconv-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-iconv.ini
=====
Message from php74-phar-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-phar.ini

MySQLサーバーに接続するためにはphp74-pdo_mysqlかphp74-mysqliが必要です。
推奨されているのはmysqliです。

root@ik1-438-51137:~ # pkg install php74-mysqli
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        php74-mysqli: 7.4.22

Number of packages to be installed: 1

42 KiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching php74-mysqli-7.4.22.txz: 100%   42 KiB  42.6kB/s    00:01
Checking integrity... done (0 conflicting)
[1/1] Installing php74-mysqli-7.4.22...
[1/1] Extracting php74-mysqli-7.4.22: 100%
=====
Message from php74-mysqli-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-mysqli.ini

さらに追加で以下をインストールしました。
hashはPHP 7.4.Xではコアに含まれるようになりました。

php74-curl
php74-exif
php74-fileinfo
php74-pecl-imagick
php74-mbstring
php74-intl
php74-openssl
php74-pcre
php74-sodium
php74-zip
php74-bcmath
php74-gd
php74-pecl-mcrypt
php74-zlib

root@ik1-438-51137:~ # pkg install php74-curl php74-exif php74-fileinfo php74-pecl-imagick php74-mbstring php74-intl php74-openssl  php74-sodium php74-zip php74-bcmath php74-gd php74-pecl-mcrypt php74-zlib
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 79 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        ImageMagick6-nox11: 6.9.12.12,1
        avahi-app: 0.8
        ca_root_nss: 3.63
        cups: 2.3.3op2
        curl: 7.77.0
        dbus: 1.12.20_5
        dbus-glib: 0.110
        expat: 2.4.1
        fftw3: 3.3.9
        fontconfig: 2.13.93_1,1
        freetype2: 2.10.4
        fribidi: 1.0.10
        gdbm: 1.20
        ghostscript9-agpl-base: 9.52_18
        giflib: 5.2.1
        glib: 2.66.8,2
        gmp: 6.2.1
        gnome_subr: 1.0
        gnutls: 3.6.15
        graphite2: 1.3.14
        gsfonts: 8.11_8
        harfbuzz: 2.8.1
        jbig2dec: 0.19
        jbigkit: 2.1_1
        jpeg-turbo: 2.0.6
        lcms2: 2.12
        libICE: 1.0.10,1
        libSM: 1.2.3,1
        libX11: 1.7.2,1
        libXau: 1.0.9
        libXdmcp: 1.1.3
        libdaemon: 0.14_1
        libevent: 2.1.12
        libffi: 3.3_1
        libgd: 2.3.1,1
        libidn: 1.35
        libidn2: 2.3.1
        liblqr-1: 0.4.2
        libltdl: 2.4.6
        libmcrypt: 2.5.8_3
        libnghttp2: 1.43.0
        libpaper: 1.1.24.4
        libpthread-stubs: 0.4
        libraqm: 0.7.1
        libraw: 0.20.2
        libsodium: 1.0.18
        libtasn1: 4.17.0
        libunistring: 0.9.10_1
        libwmf-nox11: 0.2.12
        libxcb: 1.14_1
        libzip: 1.7.3
        mpdecimal: 2.5.1
        nettle: 3.7.3
        oniguruma: 6.9.7.1
        openjpeg: 2.4.0
        p11-kit: 0.24.0
        perl5: 5.32.1_1
        php74-bcmath: 7.4.22
        php74-curl: 7.4.22
        php74-exif: 7.4.22
        php74-fileinfo: 7.4.22
        php74-gd: 7.4.22
        php74-intl: 7.4.22
        php74-mbstring: 7.4.22
        php74-openssl: 7.4.22
        php74-pecl-imagick: 3.4.4_2
        php74-pecl-mcrypt: 1.0.4
        php74-sodium: 7.4.22
        php74-zip: 7.4.22
        php74-zlib: 7.4.22
        pkgconf: 1.7.4,1
        png: 1.6.37_1
        poppler-data: 0.4.10
        python38: 3.8.10
        tiff: 4.3.0
        tpm-emulator: 0.7.4_2
        trousers: 0.3.14_3
        webp: 1.2.0
        xorgproto: 2021.4

Number of packages to be installed: 79

The process will require 409 MiB more space.
91 MiB to be downloaded.
Proceed with this action? [y/N]: y
[1/79] Fetching php74-curl-7.4.22.txz: 100%   31 KiB  31.9kB/s    00:01
[2/79] Fetching php74-exif-7.4.22.txz: 100%   29 KiB  29.7kB/s    00:01
[3/79] Fetching php74-fileinfo-7.4.22.txz: 100%  268 KiB 274.7kB/s    00:01
[4/79] Fetching php74-pecl-imagick-3.4.4_2.txz: 100%   89 KiB  91.3kB/s    00:01
[5/79] Fetching php74-mbstring-7.4.22.txz: 100%  746 KiB 763.7kB/s    00:01
[6/79] Fetching php74-intl-7.4.22.txz: 100%  124 KiB 126.8kB/s    00:01
[7/79] Fetching php74-openssl-7.4.22.txz: 100%   57 KiB  58.3kB/s    00:01
[8/79] Fetching php74-sodium-7.4.22.txz: 100%   23 KiB  23.4kB/s    00:01
[9/79] Fetching php74-zip-7.4.22.txz: 100%   21 KiB  21.3kB/s    00:01
[10/79] Fetching php74-bcmath-7.4.22.txz: 100%   19 KiB  19.9kB/s    00:01
[11/79] Fetching php74-gd-7.4.22.txz: 100%   30 KiB  30.8kB/s    00:01
[12/79] Fetching php74-pecl-mcrypt-1.0.4.txz: 100%   15 KiB  15.0kB/s    00:01
[13/79] Fetching php74-zlib-7.4.22.txz: 100%   18 KiB  18.1kB/s    00:01
[14/79] Fetching curl-7.77.0.txz: 100%    1 MiB   1.4MB/s    00:01
[15/79] Fetching libnghttp2-1.43.0.txz: 100%  123 KiB 126.4kB/s    00:01
[16/79] Fetching ca_root_nss-3.63.txz: 100%  276 KiB 282.1kB/s    00:01
[17/79] Fetching ImageMagick6-nox11-6.9.12.12,1.txz: 100%    7 MiB   7.6MB/s    00:01
[18/79] Fetching fontconfig-2.13.93_1,1.txz: 100%  210 KiB 214.8kB/s    00:01
[19/79] Fetching expat-2.4.1.txz: 100%  103 KiB 105.0kB/s    00:01
[20/79] Fetching freetype2-2.10.4.txz: 100%    1 MiB   1.4MB/s    00:01
[21/79] Fetching png-1.6.37_1.txz: 100%  291 KiB 298.3kB/s    00:01
[22/79] Fetching libraqm-0.7.1.txz: 100%   28 KiB  28.7kB/s    00:01
[23/79] Fetching harfbuzz-2.8.1.txz: 100%  783 KiB 801.7kB/s    00:01
[24/79] Fetching graphite2-1.3.14.txz: 100%  100 KiB 102.3kB/s    00:01
[25/79] Fetching glib-2.66.8,2.txz: 100%    3 MiB   3.3MB/s    00:01
[26/79] Fetching python38-3.8.10.txz: 100%   17 MiB  17.9MB/s    00:01
[27/79] Fetching mpdecimal-2.5.1.txz: 100%  322 KiB 329.5kB/s    00:01
[28/79] Fetching libffi-3.3_1.txz: 100%   39 KiB  40.1kB/s    00:01
[29/79] Fetching fribidi-1.0.10.txz: 100%   79 KiB  80.4kB/s    00:01
[30/79] Fetching gsfonts-8.11_8.txz: 100%    4 MiB   4.2MB/s    00:01
[31/79] Fetching ghostscript9-agpl-base-9.52_18.txz: 100%   16 MiB   8.4MB/s    00:02
[32/79] Fetching libpaper-1.1.24.4.txz: 100%   24 KiB  24.4kB/s    00:01
[33/79] Fetching cups-2.3.3op2.txz: 100%    1 MiB   1.5MB/s    00:01
[34/79] Fetching gnutls-3.6.15.txz: 100%    2 MiB   2.5MB/s    00:01
[35/79] Fetching trousers-0.3.14_3.txz: 100%  476 KiB 487.0kB/s    00:01
[36/79] Fetching tpm-emulator-0.7.4_2.txz: 100%  114 KiB 116.4kB/s    00:01
[37/79] Fetching gmp-6.2.1.txz: 100%  478 KiB 490.0kB/s    00:01
[38/79] Fetching p11-kit-0.24.0.txz: 100%  449 KiB 460.0kB/s    00:01
[39/79] Fetching libtasn1-4.17.0.txz: 100%  595 KiB 609.6kB/s    00:01
[40/79] Fetching nettle-3.7.3.txz: 100%    1 MiB   1.5MB/s    00:01
[41/79] Fetching libidn2-2.3.1.txz: 100%  110 KiB 113.1kB/s    00:01
[42/79] Fetching libunistring-0.9.10_1.txz: 100%  518 KiB 530.9kB/s    00:01
[43/79] Fetching avahi-app-0.8.txz: 100%  340 KiB 348.5kB/s    00:01
[44/79] Fetching gnome_subr-1.0.txz: 100%    2 KiB   1.8kB/s    00:01
[45/79] Fetching libevent-2.1.12.txz: 100%  321 KiB 328.8kB/s    00:01
[46/79] Fetching libdaemon-0.14_1.txz: 100%   32 KiB  33.1kB/s    00:01
[47/79] Fetching dbus-glib-0.110.txz: 100%  164 KiB 167.9kB/s    00:01
[48/79] Fetching dbus-1.12.20_5.txz: 100%  368 KiB 376.9kB/s    00:01
[49/79] Fetching libX11-1.7.2,1.txz: 100%    2 MiB   1.7MB/s    00:01
[50/79] Fetching libxcb-1.14_1.txz: 100%    1 MiB   1.1MB/s    00:01
[51/79] Fetching libXdmcp-1.1.3.txz: 100%   15 KiB  15.0kB/s    00:01
[52/79] Fetching xorgproto-2021.4.txz: 100%  221 KiB 226.8kB/s    00:01
[53/79] Fetching libXau-1.0.9.txz: 100%   11 KiB  11.3kB/s    00:01
[54/79] Fetching libpthread-stubs-0.4.txz: 100%    2 KiB   2.0kB/s    00:01
[55/79] Fetching libSM-1.2.3,1.txz: 100%   24 KiB  24.5kB/s    00:01
[56/79] Fetching libICE-1.0.10,1.txz: 100%   92 KiB  94.2kB/s    00:01
[57/79] Fetching gdbm-1.20.txz: 100%  175 KiB 179.6kB/s    00:01
[58/79] Fetching tiff-4.3.0.txz: 100%  846 KiB 866.6kB/s    00:01
[59/79] Fetching jpeg-turbo-2.0.6.txz: 100%  343 KiB 351.0kB/s    00:01
[60/79] Fetching jbigkit-2.1_1.txz: 100%   73 KiB  74.4kB/s    00:01
[61/79] Fetching poppler-data-0.4.10.txz: 100%    2 MiB   1.6MB/s    00:01
[62/79] Fetching jbig2dec-0.19.txz: 100%   87 KiB  89.1kB/s    00:01
[63/79] Fetching libidn-1.35.txz: 100%  216 KiB 221.1kB/s    00:01
[64/79] Fetching fftw3-3.3.9.txz: 100%  753 KiB 771.5kB/s    00:01
[65/79] Fetching perl5-5.32.1_1.txz: 100%   14 MiB  14.9MB/s    00:01
[66/79] Fetching webp-1.2.0.txz: 100%  396 KiB 405.8kB/s    00:01
[67/79] Fetching giflib-5.2.1.txz: 100%  232 KiB 237.3kB/s    00:01
[68/79] Fetching openjpeg-2.4.0.txz: 100%  303 KiB 310.6kB/s    00:01
[69/79] Fetching lcms2-2.12.txz: 100%    2 MiB   2.0MB/s    00:01
[70/79] Fetching libwmf-nox11-0.2.12.txz: 100%    2 MiB   2.2MB/s    00:01
[71/79] Fetching libgd-2.3.1,1.txz: 100%  202 KiB 206.9kB/s    00:01
[72/79] Fetching libraw-0.20.2.txz: 100%  532 KiB 545.0kB/s    00:01
[73/79] Fetching liblqr-1-0.4.2.txz: 100%   42 KiB  43.0kB/s    00:01
[74/79] Fetching pkgconf-1.7.4,1.txz: 100%   66 KiB  67.8kB/s    00:01
[75/79] Fetching libltdl-2.4.6.txz: 100%   37 KiB  38.3kB/s    00:01
[76/79] Fetching oniguruma-6.9.7.1.txz: 100%  230 KiB 235.8kB/s    00:01
[77/79] Fetching libsodium-1.0.18.txz: 100%  264 KiB 270.0kB/s    00:01
[78/79] Fetching libzip-1.7.3.txz: 100%  214 KiB 219.4kB/s    00:01
[79/79] Fetching libmcrypt-2.5.8_3.txz: 100%  120 KiB 122.9kB/s    00:01
Checking integrity... done (0 conflicting)
[1/79] Installing xorgproto-2021.4...
[1/79] Extracting xorgproto-2021.4: 100%
[2/79] Installing libXdmcp-1.1.3...
[2/79] Extracting libXdmcp-1.1.3: 100%
[3/79] Installing libXau-1.0.9...
[3/79] Extracting libXau-1.0.9: 100%
[4/79] Installing libpthread-stubs-0.4...
[4/79] Extracting libpthread-stubs-0.4: 100%
[5/79] Installing mpdecimal-2.5.1...
[5/79] Extracting mpdecimal-2.5.1: 100%
[6/79] Installing libffi-3.3_1...
[6/79] Extracting libffi-3.3_1: 100%
[7/79] Installing libxcb-1.14_1...
[7/79] Extracting libxcb-1.14_1: 100%
[8/79] Installing libICE-1.0.10,1...
[8/79] Extracting libICE-1.0.10,1: 100%
[9/79] Installing expat-2.4.1...
[9/79] Extracting expat-2.4.1: 100%
[10/79] Installing python38-3.8.10...
[10/79] Extracting python38-3.8.10: 100%
[11/79] Installing gmp-6.2.1...
[11/79] Extracting gmp-6.2.1: 100%
[12/79] Installing libX11-1.7.2,1...
[12/79] Extracting libX11-1.7.2,1: 100%
[13/79] Installing libSM-1.2.3,1...
[13/79] Extracting libSM-1.2.3,1: 100%
[14/79] Installing ca_root_nss-3.63...
[14/79] Extracting ca_root_nss-3.63: 100%
[15/79] Installing png-1.6.37_1...
[15/79] Extracting png-1.6.37_1: 100%
[16/79] Installing glib-2.66.8,2...
[16/79] Extracting glib-2.66.8,2: 100%
No schema files found: doing nothing.
[17/79] Installing tpm-emulator-0.7.4_2...
===> Creating groups.
Creating group '_tss' with gid '601'.
===> Creating users
Creating user '_tss' with uid '601'.
[17/79] Extracting tpm-emulator-0.7.4_2: 100%
[18/79] Installing libtasn1-4.17.0...
[18/79] Extracting libtasn1-4.17.0: 100%
[19/79] Installing libunistring-0.9.10_1...
[19/79] Extracting libunistring-0.9.10_1: 100%
[20/79] Installing dbus-1.12.20_5...
===> Creating groups.
Creating group 'messagebus' with gid '556'.
===> Creating users
Creating user 'messagebus' with uid '556'.
[20/79] Extracting dbus-1.12.20_5: 100%
[21/79] Installing jpeg-turbo-2.0.6...
[21/79] Extracting jpeg-turbo-2.0.6: 100%
[22/79] Installing jbigkit-2.1_1...
[22/79] Extracting jbigkit-2.1_1: 100%
[23/79] Installing freetype2-2.10.4...
[23/79] Extracting freetype2-2.10.4: 100%
[24/79] Installing trousers-0.3.14_3...
===> Creating groups.
Using existing group '_tss'.
===> Creating users
Using existing user '_tss'.
[24/79] Extracting trousers-0.3.14_3: 100%
[25/79] Installing p11-kit-0.24.0...
[25/79] Extracting p11-kit-0.24.0: 100%
[26/79] Installing nettle-3.7.3...
[26/79] Extracting nettle-3.7.3: 100%
[27/79] Installing libidn2-2.3.1...
[27/79] Extracting libidn2-2.3.1: 100%
[28/79] Installing gnome_subr-1.0...
[28/79] Extracting gnome_subr-1.0: 100%
[29/79] Installing libevent-2.1.12...
[29/79] Extracting libevent-2.1.12: 100%
[30/79] Installing libdaemon-0.14_1...
[30/79] Extracting libdaemon-0.14_1: 100%
[31/79] Installing dbus-glib-0.110...
[31/79] Extracting dbus-glib-0.110: 100%
[32/79] Installing gdbm-1.20...
[32/79] Extracting gdbm-1.20: 100%
[33/79] Installing tiff-4.3.0...
[33/79] Extracting tiff-4.3.0: 100%
[34/79] Installing giflib-5.2.1...
[34/79] Extracting giflib-5.2.1: 100%
[35/79] Installing fontconfig-2.13.93_1,1...
[35/79] Extracting fontconfig-2.13.93_1,1: 100%
[36/79] Installing graphite2-1.3.14...
[36/79] Extracting graphite2-1.3.14: 100%
[37/79] Installing libpaper-1.1.24.4...
[37/79] Extracting libpaper-1.1.24.4: 100%
[38/79] Installing gnutls-3.6.15...
[38/79] Extracting gnutls-3.6.15: 100%
[39/79] Installing avahi-app-0.8...
===> Creating groups.
Creating group 'avahi' with gid '558'.
===> Creating users
Creating user 'avahi' with uid '558'.
[39/79] Extracting avahi-app-0.8: 100%
[40/79] Installing webp-1.2.0...
[40/79] Extracting webp-1.2.0: 100%
[41/79] Installing harfbuzz-2.8.1...
[41/79] Extracting harfbuzz-2.8.1: 100%
[42/79] Installing fribidi-1.0.10...
[42/79] Extracting fribidi-1.0.10: 100%
[43/79] Installing cups-2.3.3op2...
===> Creating groups.
Creating group 'cups' with gid '193'.
===> Creating users
Creating user 'cups' with uid '193'.
[43/79] Extracting cups-2.3.3op2: 100%
[44/79] Installing poppler-data-0.4.10...
[44/79] Extracting poppler-data-0.4.10: 100%
[45/79] Installing jbig2dec-0.19...
[45/79] Extracting jbig2dec-0.19: 100%
[46/79] Installing libidn-1.35...
[46/79] Extracting libidn-1.35: 100%
[47/79] Installing lcms2-2.12...
[47/79] Extracting lcms2-2.12: 100%
[48/79] Installing libgd-2.3.1,1...
[48/79] Extracting libgd-2.3.1,1: 100%
[49/79] Installing libnghttp2-1.43.0...
[49/79] Extracting libnghttp2-1.43.0: 100%
[50/79] Installing libraqm-0.7.1...
[50/79] Extracting libraqm-0.7.1: 100%
[51/79] Installing gsfonts-8.11_8...
[51/79] Extracting gsfonts-8.11_8: 100%
[52/79] Installing ghostscript9-agpl-base-9.52_18...
[52/79] Extracting ghostscript9-agpl-base-9.52_18: 100%
[53/79] Installing fftw3-3.3.9...
[53/79] Extracting fftw3-3.3.9: 100%
[54/79] Installing perl5-5.32.1_1...
[54/79] Extracting perl5-5.32.1_1: 100%
[55/79] Installing openjpeg-2.4.0...
[55/79] Extracting openjpeg-2.4.0: 100%
[56/79] Installing libwmf-nox11-0.2.12...
[56/79] Extracting libwmf-nox11-0.2.12: 100%
[57/79] Installing libraw-0.20.2...
[57/79] Extracting libraw-0.20.2: 100%
[58/79] Installing liblqr-1-0.4.2...
[58/79] Extracting liblqr-1-0.4.2: 100%
[59/79] Installing pkgconf-1.7.4,1...
[59/79] Extracting pkgconf-1.7.4,1: 100%
[60/79] Installing libltdl-2.4.6...
[60/79] Extracting libltdl-2.4.6: 100%
[61/79] Installing curl-7.77.0...
[61/79] Extracting curl-7.77.0: 100%
[62/79] Installing ImageMagick6-nox11-6.9.12.12,1...
[62/79] Extracting ImageMagick6-nox11-6.9.12.12,1: 100%
[63/79] Installing oniguruma-6.9.7.1...
[63/79] Extracting oniguruma-6.9.7.1: 100%
[64/79] Installing libsodium-1.0.18...
[64/79] Extracting libsodium-1.0.18: 100%
[65/79] Installing libzip-1.7.3...
[65/79] Extracting libzip-1.7.3: 100%
[66/79] Installing libmcrypt-2.5.8_3...
[66/79] Extracting libmcrypt-2.5.8_3: 100%
[67/79] Installing php74-curl-7.4.22...
[67/79] Extracting php74-curl-7.4.22: 100%
[68/79] Installing php74-exif-7.4.22...
[68/79] Extracting php74-exif-7.4.22: 100%
[69/79] Installing php74-fileinfo-7.4.22...
[69/79] Extracting php74-fileinfo-7.4.22: 100%
[70/79] Installing php74-pecl-imagick-3.4.4_2...
[70/79] Extracting php74-pecl-imagick-3.4.4_2: 100%
[71/79] Installing php74-mbstring-7.4.22...
[71/79] Extracting php74-mbstring-7.4.22: 100%
[72/79] Installing php74-intl-7.4.22...
[72/79] Extracting php74-intl-7.4.22: 100%
[73/79] Installing php74-openssl-7.4.22...
[73/79] Extracting php74-openssl-7.4.22: 100%
[74/79] Installing php74-sodium-7.4.22...
[74/79] Extracting php74-sodium-7.4.22: 100%
[75/79] Installing php74-zip-7.4.22...
[75/79] Extracting php74-zip-7.4.22: 100%
[76/79] Installing php74-bcmath-7.4.22...
[76/79] Extracting php74-bcmath-7.4.22: 100%
[77/79] Installing php74-gd-7.4.22...
[77/79] Extracting php74-gd-7.4.22: 100%
[78/79] Installing php74-pecl-mcrypt-1.0.4...
[78/79] Extracting php74-pecl-mcrypt-1.0.4: 100%
[79/79] Installing php74-zlib-7.4.22...
[79/79] Extracting php74-zlib-7.4.22: 100%
=====
Message from python38-3.8.10:

--
Note that some standard Python modules are provided as separate ports
as they require additional dependencies. They are available as:

py38-gdbm       databases/py-gdbm@py38
py38-sqlite3    databases/py-sqlite3@py38
py38-tkinter    x11-toolkits/py-tkinter@py38
=====
Message from ca_root_nss-3.63:

--
FreeBSD does not, and can not warrant that the certification authorities
whose certificates are included in this package have in any way been
audited for trustworthiness or RFC 3647 compliance.

Assessment and verification of trust is the complete responsibility of the
system administrator.


This package installs symlinks to support root certificates discovery by
default for software that uses OpenSSL.

This enables SSL Certificate Verification by client software without manual
intervention.

If you prefer to do this manually, replace the following symlinks with
either an empty file or your site-local certificate bundle.

  * /etc/ssl/cert.pem
  * /usr/local/etc/ssl/cert.pem
  * /usr/local/openssl/cert.pem
=====
Message from freetype2-2.10.4:

--
The 2.7.x series now uses the new subpixel hinting mode (V40 port's option) as
the default, emulating a modern version of ClearType. This change inevitably
leads to different rendering results, and you might change port's options to
adapt it to your taste (or use the new "FREETYPE_PROPERTIES" environment
variable).

The environment variable "FREETYPE_PROPERTIES" can be used to control the
driver properties. Example:

FREETYPE_PROPERTIES=truetype:interpreter-version=35 \
        cff:no-stem-darkening=1 \
        autofitter:warping=1

This allows to select, say, the subpixel hinting mode at runtime for a given
application.

If LONG_PCF_NAMES port's option was enabled, the PCF family names may include
the foundry and information whether they contain wide characters. For example,
"Sony Fixed" or "Misc Fixed Wide", instead of "Fixed". This can be disabled at
run time with using pcf:no-long-family-names property, if needed. Example:

FREETYPE_PROPERTIES=pcf:no-long-family-names=1

How to recreate fontconfig cache with using such environment variable,
if needed:
# env FREETYPE_PROPERTIES=pcf:no-long-family-names=1 fc-cache -fsv

The controllable properties are listed in the section "Controlling FreeType
Modules" in the reference's table of contents
(/usr/local/share/doc/freetype2/reference/site/index.html, if documentation was installed).
=====
Message from trousers-0.3.14_3:

--
To run tcsd automatically, add the following line to /etc/rc.conf:

tcsd_enable="YES"

You might want to edit /usr/local/etc/tcsd.conf to reflect your setup.

If you want to use tcsd with software TPM emulator, use the following
configuration in /etc/rc.conf:

tcsd_enable="YES"
tcsd_mode="emulator"
tpmd_enable="YES"

To use TPM, add your_account to '_tss' group like following:

# pw groupmod _tss -m your_account
=====
Message from ghostscript9-agpl-base-9.52_18:

--
This package installs a script named dvipdf that depends on dvips.  If you
want to use this script you need to install print/tex-dvipsk.
=====
Message from libwmf-nox11-0.2.12:

--
===>   NOTICE:

The libwmf-nox11 port currently does not have a maintainer. As a result, it is
more likely to have unresolved issues, not be up-to-date, or even be removed in
the future. To volunteer to maintain this port, please create an issue at:

https://bugs.freebsd.org/bugzilla

More information about port maintainership is available at:

https://docs.freebsd.org/en/articles/contributing/#ports-contributing
=====
Message from liblqr-1-0.4.2:

--
NOTE: In order to compile examples for liblqr, you will
also need pngwriter port (/usr/ports/graphics/pngwriter).
Examples are located in /usr/local/share/examples/liblqr-1
=====
Message from php74-curl-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-curl.ini
=====
Message from php74-exif-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-exif.ini
=====
Message from php74-fileinfo-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-fileinfo.ini
=====
Message from php74-pecl-imagick-3.4.4_2:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-imagick.ini
=====
Message from php74-mbstring-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-mbstring.ini
=====
Message from php74-intl-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-intl.ini
=====
Message from php74-openssl-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-openssl.ini
=====
Message from php74-sodium-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-sodium.ini
=====
Message from php74-zip-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-zip.ini
=====
Message from php74-bcmath-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-bcmath.ini
=====
Message from php74-gd-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-gd.ini
=====
Message from php74-pecl-mcrypt-1.0.4:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-mcrypt.ini
=====
Message from php74-zlib-7.4.22:

--
This file has been added to automatically load the installed extension:
/usr/local/etc/php/ext-20-zlib.ini

PHP-FPMの設定

Nginx Webサーバーは直接PHPコードを処理できないためFastCGIを介してPHPをCGIとして実行するため、FPM(FastCGI Process Manager)の設定を行います。

/usr/local/etc/php-fpm.d/www.conf

root@ik1-438-51137:~ # vi /usr/local/etc/php-fpm.d/www.conf
; Start a new pool named 'www'.
; the variable $pool can be used in any directive and will be replaced by the
; pool name ('www' here)
[www]

; Per pool prefix
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
; - 'chdir'
; - 'php_values'
; - 'php_admin_values'
; When not set, the global prefix (or /usr/local) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
user = www
group = www

; The address on which to accept FastCGI requests.
; Valid syntaxes are:
;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific IPv4 address on
;                            a specific port;
;   '0.0.0.0:port'         - to listen on a TCP socket to all IPv4 addresses on
;                            a specific port;
;   '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
;                            a specific port;
;   'port'                 - to listen on a TCP socket to all addresses
;                            (IPv6 and IPv4-mapped) on a specific port;
;                            Note: IPv4-mapped addresses are disabled by-default in
;                                  FreeBSD for security reasons;
;   '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php-fpm/php-fpm-$pool.sock

; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
;listen.backlog = 511

; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions. The owner
; and group can be specified either by name or by their numeric IDs.
; Default Values: user and group are set as the running user
;                 mode is set to 0660
listen.owner = www
listen.group = www
listen.mode = 0660
; When POSIX Access Control Lists are supported you can set them using
; these options, value is a comma separated list of user/group names.
; When set, listen.owner and listen.group are ignored
;listen.acl_users =
;listen.acl_groups =

; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
;listen.allowed_clients = 127.0.0.1

; Specify the nice(2) priority to apply to the pool processes (only if set)
; The value can vary from -19 (highest priority) to 20 (lower priority)
; Note: - It will only work if the FPM master process is launched as root
;       - The pool processes will inherit the master process priority
;         unless it specified otherwise
; Default Value: no set
; process.priority = -19

; Set the process dumpable flag (PR_SET_DUMPABLE prctl) even if the process user
; or group is differrent than the master process user. It allows to create process
; core dump and ptrace the process for the pool user.
; Default Value: no
; process.dumpable = yes

; Choose how the process manager will control the number of child processes.
; Possible Values:
;   static  - a fixed number (pm.max_children) of child processes;
;   dynamic - the number of child processes are set dynamically based on the
;             following directives. With this process management, there will be
;             always at least 1 children.
;             pm.max_children      - the maximum number of children that can
;                                    be alive at the same time.
;             pm.start_servers     - the number of children created on startup.
;             pm.min_spare_servers - the minimum number of children in 'idle'
;                                    state (waiting to process). If the number
;                                    of 'idle' processes is less than this
;                                    number then some children will be created.
;             pm.max_spare_servers - the maximum number of children in 'idle'
;                                    state (waiting to process). If the number
;                                    of 'idle' processes is greater than this
;                                    number then some children will be killed.
;  ondemand - no children are created at startup. Children will be forked when
;             new requests will connect. The following parameter are used:
;             pm.max_children           - the maximum number of children that
;                                         can be alive at the same time.
;             pm.process_idle_timeout   - The number of seconds after which
;                                         an idle process will be killed.
; Note: This value is mandatory.
pm = dynamic

; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 5

; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: (min_spare_servers + max_spare_servers) / 2
pm.start_servers = 2

; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 1

; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 3

; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s
;pm.process_idle_timeout = 10s;

; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
;pm.max_requests = 500

; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. It shows the following informations:
;   pool                 - the name of the pool;
;   process manager      - static, dynamic or ondemand;
;   start time           - the date and time FPM has started;
;   start since          - number of seconds since FPM has started;
;   accepted conn        - the number of request accepted by the pool;
;   listen queue         - the number of request in the queue of pending
;                          connections (see backlog in listen(2));
;   max listen queue     - the maximum number of requests in the queue
;                          of pending connections since FPM has started;
;   listen queue len     - the size of the socket queue of pending connections;
;   idle processes       - the number of idle processes;
;   active processes     - the number of active processes;
;   total processes      - the number of idle + active processes;
;   max active processes - the maximum number of active processes since FPM
;                          has started;
;   max children reached - number of times, the process limit has been reached,
;                          when pm tries to start more children (works only for
;                          pm 'dynamic' and 'ondemand');
; Value are updated in real time.
; Example output:
;   pool:                 www
;   process manager:      static
;   start time:           01/Jul/2011:17:53:49 +0200
;   start since:          62636
;   accepted conn:        190460
;   listen queue:         0
;   max listen queue:     1
;   listen queue len:     42
;   idle processes:       4
;   active processes:     11
;   total processes:      15
;   max active processes: 12
;   max children reached: 0
;
; By default the status page output is formatted as text/plain. Passing either
; 'html', 'xml' or 'json' in the query string will return the corresponding
; output syntax. Example:
;   http://www.foo.bar/status
;   http://www.foo.bar/status?json
;   http://www.foo.bar/status?html
;   http://www.foo.bar/status?xml
;
; By default the status page only outputs short status. Passing 'full' in the
; query string will also return status for each pool process.
; Example:
;   http://www.foo.bar/status?full
;   http://www.foo.bar/status?json&full
;   http://www.foo.bar/status?html&full
;   http://www.foo.bar/status?xml&full
; The Full status returns for each process:
;   pid                  - the PID of the process;
;   state                - the state of the process (Idle, Running, ...);
;   start time           - the date and time the process has started;
;   start since          - the number of seconds since the process has started;
;   requests             - the number of requests the process has served;
;   request duration     - the duration in µs of the requests;
;   request method       - the request method (GET, POST, ...);
;   request URI          - the request URI with the query string;
;   content length       - the content length of the request (only with POST);
;   user                 - the user (PHP_AUTH_USER) (or '-' if not set);
;   script               - the main script called (or '-' if not set);
;   last request cpu     - the %cpu the last request consumed
;                          it's always 0 if the process is not in Idle state
;                          because CPU calculation is done when the request
;                          processing has terminated;
;   last request memory  - the max amount of memory the last request consumed
;                          it's always 0 if the process is not in Idle state
;                          because memory calculation is done when the request
;                          processing has terminated;
; If the process is in Idle state, then informations are related to the
; last request the process has served. Otherwise informations are related to
; the current request being served.
; Example output:
;   ************************
;   pid:                  31330
;   state:                Running
;   start time:           01/Jul/2011:17:53:49 +0200
;   start since:          63087
;   requests:             12808
;   request duration:     1250261
;   request method:       GET
;   request URI:          /test_mem.php?N=10000
;   content length:       0
;   user:                 -
;   script:               /home/fat/web/docs/php/test_mem.php
;   last request cpu:     0.00
;   last request memory:  0
;
; Note: There is a real-time FPM status monitoring sample web page available
;       It's available in: /usr/local/share/php/fpm/status.html
;
; Note: The value must start with a leading slash (/). The value can be
;       anything, but it may not be a good idea to use the .php extension or it
;       may conflict with a real PHP file.
; Default Value: not set
;pm.status_path = /status

; The ping URI to call the monitoring page of FPM. If this value is not set, no
; URI will be recognized as a ping page. This could be used to test from outside
; that FPM is alive and responding, or to
; - create a graph of FPM availability (rrd or such);
; - remove a server from a group if it is not responding (load balancing);
; - trigger alerts for the operating team (24/7).
; Note: The value must start with a leading slash (/). The value can be
;       anything, but it may not be a good idea to use the .php extension or it
;       may conflict with a real PHP file.
; Default Value: not set
;ping.path = /ping

; This directive may be used to customize the response of a ping request. The
; response is formatted as text/plain with a 200 response code.
; Default Value: pong
;ping.response = pong

; The access log file
; Default: not set
;access.log = log/$pool.access.log

; The access log format.
; The following syntax is allowed
;  %%: the '%' character
;  %C: %CPU used by the request
;      it can accept the following format:
;      - %{user}C for user CPU only
;      - %{system}C for system CPU only
;      - %{total}C  for user + system CPU (default)
;  %d: time taken to serve the request
;      it can accept the following format:
;      - %{seconds}d (default)
;      - %{miliseconds}d
;      - %{mili}d
;      - %{microseconds}d
;      - %{micro}d
;  %e: an environment variable (same as $_ENV or $_SERVER)
;      it must be associated with embraces to specify the name of the env
;      variable. Some exemples:
;      - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
;      - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
;  %f: script filename
;  %l: content-length of the request (for POST request only)
;  %m: request method
;  %M: peak of memory allocated by PHP
;      it can accept the following format:
;      - %{bytes}M (default)
;      - %{kilobytes}M
;      - %{kilo}M
;      - %{megabytes}M
;      - %{mega}M
;  %n: pool name
;  %o: output header
;      it must be associated with embraces to specify the name of the header:
;      - %{Content-Type}o
;      - %{X-Powered-By}o
;      - %{Transfert-Encoding}o
;      - ....
;  %p: PID of the child that serviced the request
;  %P: PID of the parent of the child that serviced the request
;  %q: the query string
;  %Q: the '?' character if query string exists
;  %r: the request URI (without the query string, see %q and %Q)
;  %R: remote IP address
;  %s: status (response code)
;  %t: server time the request was received
;      it can accept a strftime(3) format:
;      %d/%b/%Y:%H:%M:%S %z (default)
;      The strftime(3) format must be encapsuled in a %{strftime_format}t tag
;      e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
;  %T: time the log has been written (the request has finished)
;      it can accept a strftime(3) format:
;      %d/%b/%Y:%H:%M:%S %z (default)
;      The strftime(3) format must be encapsuled in a %{strftime_format}t tag
;      e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
;  %u: remote user
;
; Default: "%R - %u %t \"%m %r\" %s"
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"

; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set
;slowlog = log/$pool.log.slow

; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_slowlog_timeout = 0

; Depth of slow log stack trace.
; Default Value: 20
;request_slowlog_trace_depth = 20

; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_terminate_timeout = 0

; The timeout set by 'request_terminate_timeout' ini option is not engaged after
; application calls 'fastcgi_finish_request' or when application has finished and
; shutdown functions are being called (registered via register_shutdown_function).
; This option will enable timeout limit to be applied unconditionally
; even in such cases.
; Default Value: no
;request_terminate_timeout_track_finished = no

; Set open file descriptor rlimit.
; Default Value: system defined value
;rlimit_files = 1024

; Set max core size rlimit.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0

; Chroot to this directory at the start. This value must be defined as an
; absolute path. When this value is not set, chroot is not used.
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
; of its subdirectories. If the pool prefix is not set, the global prefix
; will be used instead.
; Note: chrooting is a great security feature and should be used whenever
;       possible. However, all PHP paths will be relative to the chroot
;       (error_log, sessions.save_path, ...).
; Default Value: not set
;chroot =

; Chdir to this directory at the start.
; Note: relative path can be used.
; Default Value: current directory or / when chroot
;chdir = /var/www

; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
; Note: on highloaded environement, this can cause some delay in the page
; process time (several ms).
; Default Value: no
;catch_workers_output = yes

; Decorate worker output with prefix and suffix containing information about
; the child that writes to the log and if stdout or stderr is used as well as
; log level and time. This options is used only if catch_workers_output is yes.
; Settings to "no" will output data as written to the stdout or stderr.
; Default value: yes
;decorate_workers_output = no

; Clear environment in FPM workers
; Prevents arbitrary environment variables from reaching FPM worker processes
; by clearing the environment in workers before env vars specified in this
; pool configuration are added.
; Setting to "no" will make all environment variables available to PHP code
; via getenv(), $_ENV and $_SERVER.
; Default Value: yes
;clear_env = no

; Limits the extensions of the main script FPM will allow to parse. This can
; prevent configuration mistakes on the web server side. You should only limit
; FPM to .php extensions to prevent malicious users to use other extensions to
; execute php code.
; Note: set an empty value to allow all extensions.
; Default Value: .php
;security.limit_extensions = .php .php3 .php4 .php5 .php7

; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
; the current environment.
; Default Value: clean env
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp

; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI:
;   php_value/php_flag             - you can set classic ini defines which can
;                                    be overwritten from PHP call 'ini_set'.
;   php_admin_value/php_admin_flag - these directives won't be overwritten by
;                                     PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.

; Defining 'extension' will load the corresponding shared extension from
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
; overwrite previously defined php.ini values, but will append the new value
; instead.

; Note: path INI options can be relative and will be expanded with the prefix
; (pool, global or /usr/local)

; Default Value: nothing is defined by default except the values in php.ini and
;                specified at startup with the -d argument
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
;php_flag[display_errors] = off
;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M

UNIXソケットを使ってlistenするように変更しています。
次のコマンドを実行して、UNIXソケット用のディレクトリを作成します。

root@ik1-438-51137:~ # mkdir -p /var/run/php-fpm

さらにUNIXソケットにNginx Webサーバーからアクセスできるようにlisten.owner(www)とlisten.group(www)を設定しています。

設定が終わったら、システムでPHP-FPMサーバーを有効にします。
次のコマンドを実行し、/etc/rc.confにphp_fpm_enable=YESを追加します。

root@ik1-438-51137:~ # sysrc php_fpm_enable=YES
php_fpm_enable:  -> YES

これでserviceコマンドを利用できるようになります。
次のコマンドを実行して、php-fpmdデーモンを起動します。

root@ik1-438-51137:/var/run # service php-fpm start
Performing sanity check on php-fpm configuration:
[19-Aug-2021 22:04:03] NOTICE: configuration file /usr/local/etc/php-fpm.conf test is successful

Starting php_fpm.

Nginx WebサーバーにFastCGIゲートウェイ用の設定を追加します。
デフォルトのNginx構成ファイルを使って説明します。

#user  nobody;
worker_processes  1;

# This default error log path is compiled-in to make sure configuration parsing
# errors are logged somewhere, especially during unattended boot when stderr
# isn't normally logged anywhere. This path will be touched on every nginx
# start regardless of error log location configured here. See
# https://trac.nginx.org/nginx/ticket/147 for more info.
#
#error_log  /var/log/nginx/error.log;
#

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   /usr/local/www/nginx;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/local/www/nginx-dist;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #   root           html;
        #   fastcgi_pass   127.0.0.1:9000;
        #   fastcgi_index  index.php;
        #   fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #   include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #   deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

PHPプログラムが動作するのかを確かめるために、簡単なPHPプログラムを作成します。
Webルートディレクトリにファイル名info.phpとしてphpの情報を表示するプログラムを作成しました。

root@ik1-438-51137:~ # vi /usr/local/www/nginx/info.php
<?php
phpinfo();
?>

次のようにコマンドラインで実行することもできます。
Syntaxエラー(構文エラー)がないかを確認するために試してみると良いでしょう。

root@ik1-438-51137:~ # php info.php

デフォルトのNginx構成ファイル(nginx.conf)の次の個所のコメントを外します。(先頭の#を削除)
ドキュメントルートを/usr/local/www/nginxに書き換えます。
fastcgi_passをUNIXソケットに書き換えます。
fastcgi_param SCRIPT_FILENAMEを$document_root$request_filenameに書き換えます。

location ~ \.php$ {
        root           /usr/local/www/nginx;
        fastcgi_pass   unix:/var/run/php-fpm/php-fpm-www.sock;
        fastcgi_index  index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$request_filename;    
        include        fastcgi_params;
 }

Nginx Webサーバーの構成変更を反映します。
次のコマンドを実行し、Nginx Webサーバーに構成ファイルを再読み込みさせます。

root@ik1-438-51137:~ # service nginx reload
Performing sanity check on nginx configuration:
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

Webブラウザーからアクセスしてみます。
次のように表示されれば成功です。

php.info

以上でNginx WebサーバーからFastCGIゲートウェイを経由してPHPをCGIとして実行できるようになりました。
実践では複数のドメイン名を仮想サーバーで構成するためにNginx構成ファイルを書き換えたり、WordperssやMovableType用に書き換えたり、phpMyadminなど用に書き換えたりする必要があります。それに関しては他の記事で説明します。

よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

この記事を書いた人

大阪府門真市に生まれ、高校卒業まで京都府福知山市で育ち、大学は工学部電子工学科を卒業。半導体設計会社に勤務ののちインフラエンジニアとして監視基盤の運用設計業務に就く。現在は都内の施設に勤務。横浜在住。人の役に立てることができればいいなと日々思っています。

目次