Skip to content

PHP FPM

Iva edited this page Aug 23, 2024 · 6 revisions

Wordpress Docker

  • Initial Configuration for PHP-FPM (FastCGI)

    • Create the docker image configuration file Dockerfile for WordPress container in the path described below via the terminal:

      mkdir -p rootInception/srcs/requirements/wordpress/Dockerfile
    • Fill in the Dockerfile for WordPress so that it can configure a docker image that will be executed later as shown below:

      FROM debian:bullseye
      RUN apt update && apt upgrade -y && apt install -y php-fpm vim
      ENTRYPOINT ["tail", "-f", "/dev/null"]

      👉🏼 The final tail -f command will be used only initially while we build the machine, and it will be discarded later according to future modifications since this command is prohibited by the project requirements.

      👉🏼 PHP-FPM is a FastCGI, meaning it is responsible for executing .php files and transforming the output of these files into HTML pages in response to a request made to them by a server, such as NGINX.

    • Update the docker-compose.yml file by adding a service for WordPress, so that when executed, it can compose the WordPress container as well, as shown below:

      version: "3.8"
      
      services:
        nginx:
          build: requirements/nginx/.
          container_name: nginx
          ports:
            - "80:80"
        wordpress:
          build: requirements/wordpress/.
          container_name: wordpress

      👉🏼 These are the minimum configurations for PHP-FPM to run inside the container. We now need to start the WordPress container, enter it, and copy the content of some default files created during the PHP-FPM installation in the system, which should be modified for the project's functionality.

      👉🏼 This file copying step can be done in two ways: automatically or manually. I will proceed with the automatic mode, but if it becomes difficult to understand how everything works, I suggest doing it manually.

    Manual Mode: Entering the Container

    ⏮️ Previous
    Next ⏭️

Clone this wiki locally