Step 1:
Let’s install the necessary packages.
pkg install -y php81 nginx php81-extensions php81-mysqli php81-mbstring php81-curl php81-gd
Step 2:
Let’s add the new services to boot.
sysrc nginx_enable="YES" php_fpm_enable="YES"
Step 5:
Now we can start the services.
service nginx start
service php-fpm start
Step 7:
Now let’s find this function in the file below and replace it with this one.
@/usr/local/etc/nginx/nginx.conf
server {
listen 80;
server_name localhost;
root /var/www;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Step 8:
Now let’s create the directory and the file that shows the php information.
mkdir -p /var/www && echo '' > /var/www/index.php
Step 9:
Finally, we’ll restart nginx.
service nginx restart
Step 10:
You can now access it via your browser using the URL mentioned.
http://your-ip-here/