Install and configure PHP + NGINX for Ubuntu 18.04

How tonginxPHP

How to install and configuration NGINX with PHP.

It’s really simple.

Install NGINX and php-fpm

apt install nginx php-fpm

Then add this configuration to the NGINX site with which you want to enable PHP.

 location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
    }

 

This configuration will usually be added in /etc/nginx/sites-enabled/default

or the global configuration in /etc/nginx/nginx.conf

 

References:

Installing PHP for Nginx on Ubuntu 18.04


https://linuxize.com/post/how-to-install-php-on-ubuntu-18-04/