TrafeX / docker-php-nginx

Docker image with PHP-FPM 8.3 & Nginx 1.26 on Alpine Linux
https://hub.docker.com/r/trafex/php-nginx
MIT License
1.37k stars 736 forks source link

php-fpm.sock not found #84

Closed mertayasa closed 2 years ago

mertayasa commented 2 years ago

HI, i recently clone your project and i want to implement it on my laravel app.. Everything seems work fine from build.. but when i open the webpage on browser its show error page. and here what error written in logs :

connect() to unix:/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: _, request: "GET /fpm-ping HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm.sock:", host: "127.0.0.1:8080"

any workaround ?

TrafeX commented 2 years ago

Hi @mertayasa,

Can you pull the latest image and try it again? I can't reproduce it with the latest image.

LoSunny commented 2 years ago

Hello, I'm having the same issue, here is my Dockerfile

FROM alpine as buildweb

WORKDIR /web

RUN apk add --update nodejs npm git \
  && git clone https://github.com/shlinkio/shlink-web-client \
  && cd shlink-web-client \
  && npm i \
  && sed -i 's/homepage": "/homepage": "\/admin/g' package.json \
  && npm run build

FROM trafex/php-nginx:latest

WORKDIR /var/www/html
RUN curl -L -o shlink3.0.3_php8.0_dist.zip https://github.com/shlinkio/shlink/releases/download/v3.0.3/shlink3.0.3_php8.0_dist.zip \
  && unzip shlink3.0.3_php8.0_dist.zip \
  && mv shlink3.0.3_php8.0_dist/* . \
  && rm -R shlink3.0.3_php8.0_dist

COPY --from=buildweb /web/shlink-web-client/build/ /var/www/html/admin/

USER 0
RUN chown -R nobody.nobody /var/www/html /run /var/lib/nginx /var/log/nginx
USER nobody

Error code

Mar 20 10:36:13 PM  2022/03/20 14:36:13 [crit] 8#8: *3 connect() to unix:/run/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: _, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm.sock:", host: "example.com"
TrafeX commented 2 years ago

Hi @LoSunny,

I could reproduce the issue with an older version of trafex/php-nginx, but not with the latest. Can you try to pull the latest version (docker pull trafex/php-nginx:latest) and then do a new build of your container?

Or even beter; use a tagged releae by changing;

FROM trafex/php-nginx:latest

to

FROM trafex/php-nginx:2.4.0

in your image and run a new build to see if that resolves the issue.

LoSunny commented 2 years ago

It worked after changing the tag to 2.4.0. Thanks :pray:

TrafeX commented 2 years ago

Good to hear!

@mertayasa I hope this will also resolve your issue, let me know if it doesn't!

mertayasa commented 2 years ago

Ahh,, sorry for not noticing this.. latest pull work fine