Skip to content

[info] php 72로 업글했을 때 나오는 permission error 대응 #44

Closed

Description

@open2

기존 php70에서도 동일한 메시지가 나오기 때문에
긴 호흡으로 수정을 해주는 것이 필요할거 같습니다.

/var/log/nginx/error.log 메시지

2018/06/06 02:03:31 [crit] 12718#12718: *30 connect() to unix:/var/run/php72_opencode.sock failed (13: Permission denied) while connecting to upstream, client: 112.154.xxx.xxx, server: opencode.vps.phps.kr, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php72_opencode.sock:", host: "opencode.vps.phps.kr"

stackoverflow에 대응
https://serverfault.com/questions/777994/permission-denied-for-fastcgi-pass-using-php7

실제조치

/var/opt/remi/php72/php-fpm.d/www.conf 파일에서 아래처럼 수정

listen = /var/run/php72_opencode.sock

listen.owner = nobody
listen.group = nobody
listen.mode = 0660

/etc/nginx/conf.d 에서 opencode.conf를 만들어서 아래처럼 upstream을 정의

upstream opencode_backend {
server unix:/var/run/php72_opencode.sock;
}

ps -ef를 해보면

[root@opencode run]# ps -ef | grep nginx
root 12717 1 0 00:56 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nobody 12718 12717 0 00:56 ? 00:00:00 nginx: worker process
root 16238 16108 0 10:56 pts/4 00:00:00 grep --color=auto nginx

/var/run 디렉토리에서
srw-rw---- 1 nobody nobody 0 6월 6 10:39 php72_opencode.sock

Activity

  1. ibin79 commented on Jun 14, 2019

    @ibin79
    Contributor

    기본 php-fpm 은 9072 처럼 tcp socket 을 여는 방식이고요.

    알려주신 unix socket 사용시엔 소유자 설정이 추가되어야 해서, php-fpm pool 은 분리에 대한 위키에 내용을 추가해두었습니다.

    https://github.com/php79/stack/wiki/php-fpm-pool-split

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions