Serve PHP apps with Docker, PHP-FPM and Nginx

9 steps · about 3 h 25 min · Intermediate

  1. How to Configure PHP-FPM with NGINX (guide, DigitalOcean, 25 min)

    Start with the core idea: Nginx hands .php requests to PHP-FPM over FastCGI using fastcgi_pass.

  2. How to Connect NGINX to PHP-FPM Using UNIX or TCP/IP Socket (article, Tecmint, 15 min)

    Containers usually connect over TCP, so you need to know how that differs from a UNIX socket.

  3. php - Official Image (doc, Docker Hub, 15 min)

    Shows what the official php:fpm variant is and how to add extensions with the docker-php-ext helper scripts.

  4. PHP and Nginx on Docker (tutorial, DEVSENSE Blog, 20 min)

    A minimal two-container Compose file with a shared network is the quickest first working stack.

  5. Dockerize your PHP application with Nginx and PHP8-FPM (tutorial, marc.it, 25 min)

    Builds the setup step by step, adding a mounted default.conf and then PHP-FPM, so you see why each piece exists.

  6. How to set up PHP, PHP-FPM and NGINX on Docker in Windows 10 (tutorial, Pascal Landau, 40 min)

    Goes deeper into docker networks, custom images and the Compose layout for local development.

  7. Docker compose for PHP, NGINX and MYSQL (tutorial, KISPHP, 30 min)

    Adds a database, a custom PHP Dockerfile with extensions, and an Nginx image that copies the public files.

  8. NGINX PHP-FPM Configuration Guide (reference, NGINX Wiki, 20 min)

    A reference for hardening and tuning: restricting PHP locations, status pages and TCP setups for containers.

  9. FPM-NGINX - PHP Docker Images (serversideup/php) (doc, Server Side Up, 15 min)

    Compare a prebuilt single-container Nginx plus FPM image, and read its advice to copy code into the image for production.