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

后端 未结 25 1941
悲哀的现实
悲哀的现实 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:36

    The most important thing here is wich user is using nginx then do you need specify it as well

    in your nginx.conf

    user www-data;
    worker_processes  1;
    
            location / {
                root   /usr/home/user/public_html;
                index  index.php index.html index.htm;
            }
            location ~ [^/]\.php(/|$) {
                fastcgi_split_path_info ^(.+?\.php)(/.*)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param  SCRIPT_FILENAME    /usr/home/user/public_html$fastcgi_script_name;
                include fastcgi_params;
            }
    

    in your www.conf

    listen.owner = www-data
    listen.group = www-data
    ;listen.mode = 0660
    

    in your case the user and group is "www" so just replace it.

    • restart nginx and php fpm

提交回复
热议问题