The Geeky Platypus Blog has a new post showing you exactly how to Dockerise your PHP application with a PHP7-FPM and Nginx setup.
The goal that we will try to achieve is to run a simple PHP application using the official Docker repositories for both PHP and Nginx. There are several docker repositories combining PHP-FPM with Nginx, but depending on the official repositories gives you several benefits, like using a service which is configured by its maintainers and you can always choose between the latest and greatest or different versions of both services, instead of relying on someone else’s choices.
The tutorial assumes you already have both Docker and Docker Compose installed, so do that first if you don't. Then you can follow along with the rest of the steps:
- Setting up Nginx
- Adding PHP-FPM
- Setting up a mount point (in the filesystem) to your code
If all goes well you should have a complete setup of PHP 7 and Nginx running your application. If you'd like to see the complete project for reference, you can find it over on GitHub.