Rudiger
Rudiger

Reputation: 6769

Can't connect to php-fpm sock in App Runner

I've got a docker container running locally fine and now trying to host it on App Runner. I'm using supervisord to run nginx and php-fpm in the same container for simplicity sakes. Here is the config for supervisord

[supervisord]
nodaemon=true
logfile=/proc/1/fd/1
logfile_maxbytes=0

[program:start]
command=bash /start.sh
startsecs = 0
autorestart = false
startretries = 1

[program:nginx]
command=/usr/sbin/nginx -g 'daemon off;'
stdout_logfile=/proc/1/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/proc/1/fd/1
stderr_logfile_maxbytes=0

[program:php-fpm]
command=/usr/sbin/php-fpm -F
stdout_logfile=/proc/1/fd/1
stdout_logfile_maxbytes=0
stderr_logfile=/proc/1/fd/1
stderr_logfile_maxbytes=0

I connect to the unix sock upon request and this works locally:

fastcgi_pass unix:/run/php-fpm/php-fpm.sock;

If I ls the directory the sock exists at that location. In App Runner it fails with:

[crit] 30#30: *1 connect() to unix:/run/php-fpm/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: xxx.xxx.xxx.249, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "xxx.xxx.xxx.250:80"

If I ls the /run/php-fpm/ directory it's empty. If I try to start php-fpm using /usr/sbin/php-fpm -F I get:

Another FPM instance seems to already listen on /run/php-fpm/php-fpm.sock

I believe the 249 IP address is the load balancer provisioned by App Runner and 250 is the server running the container but not 100% sure (they're not my VPC IPs). I know App Runner can't run Websockets but don't believe this would affect the local nginx connecting to php-fpm.

What config do I have wrong that's preventing nginx from connecting to php-fpm in the same container?

Upvotes: 0

Views: 46

Answers (0)

Related Questions