PHP-FPM Socket permission denied

Discussion in 'Installation/Configuration' started by Pe46dro, Feb 14, 2016.

  1. Pe46dro

    Pe46dro New Member

    I installed ISP Config with i installed NGINX but when i visit a website i have a 502 Bad Gateway on error.log i found this error

    Code:
    2016/02/14 20:51:13 [crit] 12800#0: *53 connect() to unix:/var/lib/php5-fpm/web1.sock failed (13: Permission denied) while connecting to upstream, client: 80.117.55.180, server: domain.tld, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php5-fpm/web1.sock:", host: "domain.tld"
    I already checked /var/lib/php5-fpm/web1.sock permission but it seems correct

    Code:
    srw-rw----  1 web1      client0      0 Feb 14 21:16 web1.sock
    If I turn off "Use Socket For PHP-FPM" all work succes...
     
  2. ztk.me

    ztk.me Well-Known Member HowtoForge Supporter

    Is nginx running as user nginx by chance?
    Check /etc/group for clientXY entries, they're typically assigned to www-data.

    If nginx runs as "nginx" there's no way it is allowed to read from that socket.
    Either run nginx as user www-data ( nginx.conf user www-data; )
    or ... don't do this: change sockets chmod to 666 which would basically allow everything to read/write that socket and is a bad idea.

    Edit: you could also try adding nginx to www-data group $usermod -a -G www-data nginx
     
  3. Pe46dro

    Pe46dro New Member

    Ok now it work successful
     

Share This Page