nginx error connect to php5-fpm.sock failed (13: Permission denied)

后端 未结 25 1902
悲哀的现实
悲哀的现实 2020-11-27 09:12

I update nginx to 1.4.7 and php to 5.5.12, After that I got the 502 error. Before I update everything works fine.

25条回答
  •  悲&欢浪女
    2020-11-27 09:35

    The following simple fix worked for me, bypassing possible permissions issues with the socket.

    In your nginx config, set fastcgi_pass to:

    fastcgi_pass   127.0.0.1:9000;
    

    Instead of

    fastcgi_pass   /var/run/php5-fpm.sock;
    

    This must match the listen = parameter in /etc/php5/fpm/pool.d/www.conf, so also set this to:

    listen = 127.0.0.1:9000;
    

    Then restart php5-fpm and nginx

    service php5-fpm restart
    

    And

    service nginx restart
    

    For more info, see: https://wildlyinaccurate.com/solving-502-bad-gateway-with-nginx-php-fpm/

提交回复
热议问题