nginx 调用docker php-fpm 502 Bad Gateway 问题排查

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容