Why should nginx “copy” something? It seems you want to use nginx as web server, which should use " FastCGI Process Manager" image to serve a PHP application. The behaviour probably depends on the settings of ./nginx/conf.d.
Personally I would just use php:8.3-apache to avoid having an additional web-server container like nginx to serve PHP.
You might need an additional reverse proxy like nginx or Traefik if you want to run multiple services on the same host with multiple domains/paths.
Hi,
Thanks again.
Does the Dockerfile copy the files to the project folder after compilation, etc., or to the image it creates? If it copies to its own image, then enabling the volumes section will pass the raw files to Nginx for display.
If I copy the files to Nginx then why is there a need for fastcgi_pass backend:9000;?
A Dockerfile is used to build container images, it will usually write into the container image, not to the host. Then you run the container image which includes the files.
If you want to “compile” files and make them available, you would usually handle that in a running container, not in a Dockerfile.
It seems this is about a PHP application. The plain nginx Docker image can’t run PHP files, it will just serve static html, JS, CSS and image files. So you need to use FPM or need to customize nginx (add an interpreter) or use a different image.
You did not state what you want to achieve. You got PHP, Laravel, FPM and nginx. How did you get to this combination of components? Why insist on FPM and nginx, if there are easier solutions available?
We don’t really do 1:1 tutoring here, we help solving problems. I recommend to start by reading or watching some tutorials to understand the basics (for example 1, 2, 3).
Hello,
Thanks again.
I want to launch a website (portal) with Docker. This website uses React as Front-END and Lavarel as Back-END. Its database is MariaDB. Since each of these components runs in a separate container, I want to use Nginx to serve them.