How to correctly link php-fpm and Nginx Docker containers?

后端 未结 7 995
天涯浪人
天涯浪人 2020-12-02 04:20

I am trying to link 2 separate containers:

  • nginx:latest
  • php:fpm

The problem is that php scripts do not work. Perhaps the php-fpm config

7条回答
  •  感情败类
    2020-12-02 04:44

    I think we also need to give the fpm container the volume, dont we? So =>

    fpm:
        image: php:fpm
        volumes:
            - ./:/var/www/test/
    

    If i dont do this, i run into this exception when firing a request, as fpm cannot find requested file:

    [error] 6#6: *4 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 172.17.42.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://172.17.0.81:9000", host: "localhost"

提交回复
热议问题