美文网首页
nginx 调用docker php-fpm 502 Bad G

nginx 调用docker php-fpm 502 Bad G

作者: Renew全栈工程师 | 来源:发表于2022-04-06 01:09 被阅读0次

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 即可

相关文章

网友评论

      本文标题:nginx 调用docker php-fpm 502 Bad G

      本文链接:https://www.haomeiwen.com/subject/bkzlsrtx.html