On the DigitalOcean community blog they've posted a guide to setting up a LEPP server (Linux, Nginx, PHP and PostgreSQL) on a CentOS 7 instance (not specific to their own platform either, can be applied anywhere).
In this tutorial, we will create a simple web application in a two-tier architecture. Our base operating system for both nodes will be CentOS 7. The site will be powered by an Nginx web server running PHP code that talks to a PostgreSQL database. Instead of adopting a "top-down" approach seen in other LAMP or LEMP tutorials, we will use a "ground-up" approach: we will create a database tier first, then the web server and then see how the web server can connect to the database. We will call this configuration a LEPP (Linux, Nginx, PHP, PostgreSQL) stack.
They create a two-tier setup that involves the use of two CentOS systems (with examples from their own hosting options) and walk you through:
- Installing PostgreSQL
- Configuring PostgreSQL
- Updating the Database Server Firewall
- Creating and Populating the Database
- Installing Nginx
- Updating the Web Server Firewall
- Configuring Nginx
- Installing PHP
- Configuring PHP
- Creating the Web Application
It seems like a lot of steps but all of the necessary commands and configuration updates are included in each step so it's basically a copy and paste kind of walk-through.