Ubuntu 18.04

Update system
apt -y update && upgrade

Installing nginx and php-fpm
apt -y install nginx php7.2-fpm

Backup configuration
mkdir /root/backup
cp -r /etc/nginx /root/backup/
cp -r /etc/php /root/backup

Create DocumentRoot
mkdir /var/www/html
cat >> /var/www/html/index.php

<?php
phpinfo();
phpinfo(INFO_MODULES);
?>

chmod 755 /var/www/html

Configure php-fpm
vim /etc/php/7.2/fpm/pool.d/www.conf

;connect using socket or port
;listen = 127.0.0.1:9000
listen = /run/php/php7.2-fpm.sock

;only allow localhost can connect to php-fpm
listen.allowed_clients = 127.0.0.1

Configure nginx
cd /etc/nginx/conf.d/
cp default.conf php.darin.web.id.conf
vim php.darin.web.id.conf

server {
    listen       80;
    server_name  php.darin.web.id;

    access_log  /var/log/nginx/php.darin.web.id_access.log;
    error_log   /var/log/nginx/php.darin.web.id_error.log;

    location / {
        root   /var/www/html/;
        index  index.php;
    }

    location ~ \.php$ {   
        try_files $uri /index.php =404;
        #fastcgi_pass   127.0.0.1:9000;
        fastcgi_pass    unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index   index.php;
        fastcgi_split_path_info ^(.+\.php)(.*)$;
        #SCRIPT_FILENAME parameter is set to $document_root$fastcgi_script_name
        fastcgi_param   SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;
        include        fastcgi_params;

    }
}

systemctl restart nginx
systemctl restart php7.2-fpm

Enable php-fpm status page
php-fpm has a very useful built-in status page that will provide details about php-fpm's health. This can also be useful for scripts to check the status and monitor for issues. Setup can be configured by uncommenting (or adding) an option in the php-fpm pool configuration file and ensuring the web server allows the traffic.

vim /etc/php/7.2/fpm/pool.d/www.conf

;uncomment line below
pm.status_path = /status

vim /etc/nginx/nginx.conf

#add this location block
    location = /status {
    access_log off;

    allow 127.0.0.1;
    allow 203.128.75.75; #your-ip-public
    deny all;

    include fastcgi_params;
    #fastcgi_pass 127.0.0.1:9000;
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    fastcgi_param  SCRIPT_FILENAME  /var/www/html$fastcgi_script_name;
    }

systemctl restart nginx
systemctl restart php7.2-fpm