How To Install PHP-FPM on Ubuntu Server 20.04

Follow these steps to install PHP_FPM

Step 1 : Add PHP PPA Repository

Step 2 : Update the apt package repository and install PHP_FPM

Step 3 : Run command to install additional packages:

Step 4 : Check if FPM services is properly installed and running

Step 5 : Configure Nginx to use the PHP processor. We will modify the /etc/nginx/sites-available/example.com file:

Step 6 : Find a line stating the priority of the index file and add index.php as a first option:

Step 7 : Next, add the following two location directives

Step 8 : Save the changes and exit the file. Restart PHP_FPM and Nginx for the changes to take effect:

Step 9 : Create an index.php file with some PHP code in it at the path mentioned in the default site configuration

Step 10 : Open your browser and point it to your domain. You should see the result of your PHP script: