update to latest repo

# mkdir -p /usr/local/etc/pkg/repos
# echo 'FreeBSD: { url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest" }' > /usr/local/etc/pkg/repos/FreeBSD.conf
# pkg update -f

install nginx and php

# pkg install ouch nginx php82 php82-curl php82-ctype php82-dom php82-mbstring php82-gd php82-session php82-simplexml php82-xml php82-zip openssl31 php82-pecl-APCu php82-opcache php82-pecl-yaml php82-pecl-xdebug php82-filter

config php-fpm

copy php config file

# cp -v /usr/local/etc/php.ini-production /usr/local/etc/php.ini

Uncomment the line ;cgi.fix_pathinfo=1 in the /usr/local/etc/php.ini file and set the value to 0.

cgi.fix_pathinfo=0

Edit the configuration file at /usr/local/etc/php-fpm.d/www.conf

Uncomment the following lines:

listen.owner = www
listen.group = www
listen.mode = 0660

Comment the line listen = 127.0.0.1:9000 and add the php-fpm socket as below:

;listen = 127.0.0.1:9000
listen = /var/run/php82-fpm.sock;

start php-fpm

# sysrc php_fpm_enable=YES
# service php-fpm start

config nginx

Edit the nginx.conf file /usr/local/etc/nginx/nginx.conf

user  www;
worker_processes  2;
error_log /var/log/nginx/error.log info;

events {
    worker_connections  1024;
}

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

    access_log /var/log/nginx/access.log;

    sendfile        on;
    keepalive_timeout  65;

    server {
        listen       80;
        server_name  example.com www.example.com;
        root /usr/local/www/grav;
        index index.php index.html index.htm;

        location / {
            try_files $uri $uri/ /index.php?q=$uri&$args;
        }

        error_page      500 502 503 504  /50x.html;
        location = /50x.html {
            root /usr/local/www/nginx-dist;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php82-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $request_filename;
                include fastcgi_params;
        }
    }
}

start nginx

# sysrc nginx_enable=YES
# service nginx start

fetch

ouch

chown -R www:www grav