How to configure NGINX and php-fpm / fastcgi

  1. Setup Red Hat Software Collections
  2. Install Nginx and PHP FPM
    # yum install rh-nginx18-nginx rh-php70-php-fpm.x86_64 
  3. Edit the file /etc/opt/rh/rh-nginx18/nginx/nginx.conf. There is a section in the default NGINX configuration that you can start with. It will look similar to the section below, but there is a slight modification below to the fastcgi_param line.
    # vim /etc/opt/rh/rh-nginx18/nginx/nginx.conf 

    location ~ \.php$ {
       root           html;
       fastcgi_pass   127.0.0.1:9000;
       fastcgi_index  index.php;
       fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
       include        fastcgi_params;
    }
    The $document_root will be the location where you can keep your PHP scripts. $fastcgi_script_name is the name of the script to be executed. So, in the example configuration above, your script would be located in /opt/rh/nginx16/root/usr/share/nginx/html/test.php.

  4. Start php-fpm and the webserver!
    # systemctl start rh-php70-php-fpm rh-nginx18-nginx
    # systemctl enable rh-php70-php-fpm rh-nginx18-nginx 

https://access.redhat.com/solutions/2425091 FIXME https://www.tqhosting.com/kb/464/How-to-install-PHP-70-PHP-FPM-on-Ubuntu-1604-LTS-Xenial-Xerus.html