Prerequsities
You must have SSH access to the Debian 10 system with Sudo privileges.
Nginx Installation
Nginx packages are available under default repositories. SSH to your Debian 10 system with sudo privileges accounts and install the Nginx web server from the official repository.
PHP Installation
For the PHP installation we recommend to use Ondřej Surý‘s PPA, which provides latest PHP versions for Debian systems. Use the below couple of commands to add the PPA to your system. Then install PHP latest version available on the day of writing this tutorial. Simply execute follows commands for the installation of PHP and PHP-FPM packages. After installing the above packages php7.3-fpm service will automatically be started. You can make sure by typing below command on terminal.
Nginx Configuration
Let’s create Nginx virtual host to run with FPM/FastCGI. For this tutorial, we use default VirtualHost. Edit VirtualHost host configuration file in a text editor. You can create new VirtualHost as per your requirements, so make sure to enable any new VirtualHost. Use the below basic Nginx Virtual host configuration with PHP FPM settings. Update the configuration as followings.
Save your changes to the configuration file and create a link to site enabled directory. Then restart Nginx service to reload the changes.
Test Setup
Create a PHP script with phpinfo() function and place it to your server document root. Use below command to do it. Now access the info.php using server IP address (for default VirtualHost) for your configured domain in Nginx VirtualHost.
Conclusion
All done. You have successfully configured Nginx web server with PHP-FPM on your Debian 10 (Buster) Linux. Your server is ready to host websites.