Installing Nginx with PHP_FPM
In this recipe, we will learn how to install and set up Nginx as a web server. We will also install PHP to be able to serve dynamic content. We need to install PHP_FPM (FastCGI Process Manager), as Nginx doesn't support the native execution of PHP scripts. We will install the latest stable version available from the Nginx package repository.
Getting ready
You will need access to a root account or an account with sudo
privileges.
How to do it…
Follow these steps to install Nginx with PHP_FPM:
Update the
apt
package repository and install Nginx. As of writing this Ubuntu 16.04 repository contains latest stable release of Nginx with version 1.10.0:$ sudo apt-get update $ sudo apt-get install nginx
Check if Nginx is properly installed and running:
$ sudo service nginx status
Check the installed version of Nginx:
$ nginx -v
You may want to point your browser to the server IP or domain. You should see a default Nginx welcome page:
Next, proceed with installing PHP_FPM...