nginx 与 php-fpm socket 所有者权限问题

【字号: 日期:2022-07-04浏览:22作者:雯心

问题描述

配置完 ngix + php-fpmnginx 报错:

2014/12/08 12:19:19 [crit] 27575#0: *4 connect() to unix:/var/run/php-fpm/vbox.dev.sock failed (13: Permission denied) while connecting to upstream, client: 192.168.56.101, server: vbox.dev, request: 'GET /index.php HTTP/1.1', upstream: 'fastcgi://unix:/var/run/php-fpm/vbox.dev.sock:', host: 'vbox.dev'

相关配置如下:

php-fpm

[vbox.dev]user = nginxgroup = nginxlisten = /var/run/php-fpm/vbox.dev.socklisten.owner = nginxlisten.group = nginxlisten.mode = 0660pm = dynamicpm.max_children = 75pm.start_servers = 10pm.min_spare_servers = 5pm.max_spare_servers = 20pm.max_requests = 500env[HOSTNAME] = $HOSTNAMEenv[PATH] = /usr/local/bin:/usr/bin:/binenv[TMP] = /tmpenv[TMPDIR] = /tmpenv[TEMP] = /tmp

文件权限:

ls -al /var/run/php-fpm/vbox.dev.sock srw-rw----. 1 nginx nginx 0 Dec 8 12:19 /var/run/php-fpm/vbox.dev.sockps -ef | grep nginx:root 27573 1 0 12:17 ?00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.confnginx 27575 27573 0 12:17 ?00:00:00 nginx: worker processps -ef | grep php-fpmroot 27587 1 0 12:19 ?00:00:00 php-fpm: master process (/etc/php-fpm.conf) nginx 27588 27587 0 12:19 ?00:00:00 php-fpm: pool vbox.dev nginx 27589 27587 0 12:19 ?00:00:00 php-fpm: pool vbox.dev nginx 27590 27587 0 12:19 ?00:00:00 php-fpm: pool vbox.dev nginx 27591 27587 0 12:19 ?00:00:00 php-fpm: pool vbox.dev nginx 27592 27587 0 12:19 ?00:00:00 php-fpm: pool vbox.dev nginx 27593 27587 0 12:19 ?00:00:00 php-fpm: pool vbox.dev nginx 27594 27587 0 12:19 ?00:00:00 php-fpm: pool vbox.dev nginx 27595 27587 0 12:19 ?00:00:00 php-fpm: pool vbox.dev nginx 27596 27587 0 12:19 ?00:00:00 php-fpm: pool vbox.dev nginx 27597 27587 0 12:19 ?00:00:00 php-fpm: pool vbox.dev www-data 27598 27587 0 12:19 ?00:00:00 php-fpm: pool global-pool

求指点!

问题解答

回答1:

listen.owner = nginxlisten.group = nginxlisten.mode = 0660

以上 listen.owner listen.group 可不设定listen.mode = 0666

另外建议sock文件放在/dev/shm目录下此目录下将sock文件放在内存里面,有助于性能提升

回答2:

Permission denied ...

在没有权限呀!

在root下执行。

回答3:

你问题解决了么?没解决的话能让我看下你/var/run/php-fpm这个目录的权限么

相关文章: