nginx是在服务器上运行,php-fpm是在docker上运行,nginx 调用php-fpm 出现 502 Bad Gateway
1.排查是否运行php-fpm 后导致php-fpm后台运行,docker container 停止了,然后无法访问
docker ps
如果有php-fpm镜像在,说明没有停止
2.排查php-fpm.d/www.conf 配置文件
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = 127.0.0.1:9000
其中listen = 127.0.0.1:9000 是不对的,监听的是docker 本地127.0.0.1,改成
listen = 0.0.0.0:9000 即可