S
S
sflyer2018-07-11 08:23:37
PHP
sflyer, 2018-07-11 08:23:37

How to set up nginx and php containers?

I'm new to docker and I'm facing a problem. There are two containers: NGINX and php
NGINX does not see php, 404 error.
What I tried:
Forward the port to the host machine and connect as 127.0.0.1:9000
Specify php:9000 - after that the nginx container does not start.
PHP works exactly (tested by running in bash).
An example of a piece of the nginx config.

location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            include        fastcgi_params;
        }

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Ainur Valiev, 2018-07-16
@vaajnur

better use php-fpm
phpjs.ru/2017/09/07/nginx-php-fpm-%D0%BD%D0%B0-vps...

V
Valery, 2018-07-25
@Akuma

Most likely you have the wrong container with PHP.
You need exactly php-fpm, unless of course you manually configure everything.
In nginx, you need to specify exactly CONTAINER_NAME: 9000
The port itself can not be opened outside, it is already open to the internal network in php-fpm

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question