PHP - connect() to unix:/run/php/php-fpm.sock failed (13: Permission denied)
1. 원인
php-fpm의 www.conf에 설정된 사용자와 그룹명이 제대로 지정되지않았기 때문에 발생하는 에러다. php-fpm을 실행시키킬 권한을 가진 사용자로 변경하면 된다.
2. 해결법
# nano /etc/php/php버전/fpm/pool.d/www.conf
# vi /etc/php/php버전/fpm/pool.d/www.conf
# vim /etc/php/php버전/fpm/pool.d/www.conf
user = www-data
group = www-data
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
주석되어있는 부분은 해제하고(주석표시 ;) 위와같이 변경한다.
www-data는 Ubuntu의 기본 설정 사용자이므로 www-data로 변경하면 php-fpm을 실행할 수 있다.
systemctl restart php-fpm
www.conf 파일을 변경한 후, php-fpm을 재시작해야 한다.
참고 사이트 :
https://askubuntu.com/questions/873839/what-is-the-www-data-user
What is the www-data user?
I'm working through How To Serve Django Applications with uWSGI and Nginx on Ubuntu 16.04. At the end of the "Create a systemd Unit File for uWSGI" in the article they discuss the www-data user. W...
askubuntu.com
https://serverfault.com/questions/777994/permission-denied-for-fastcgi-pass-using-php7
Permission Denied for fastcgi_pass using PHP7
I'm running LEMP with PHP7.0. I've got this in my server block fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; But when I open the site, it returns a 502 Bad Gateway. Below is the error log. *1
serverfault.com
nginx error connect to php5-fpm.sock failed (13: Permission denied)
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. nginx-error.log 2014/05/03 13:27:41 [crit] 4202#0: *1 connect() to unix:/var/run/...
stackoverflow.com