vagrant 安装的 centos 6.8 php 装的 7.1 web 服务器用的 openresty nginx 用户是 nobody php-fpm 也是 nobody web 目录所有者是 vagrant 死活解析不了 php 文件. 必须要把 php-fpm 放在 root 用户下启动才行 这是为什么? 求高手指导一二
1
UnisandK 2017-03-29 09:54:50 +08:00
chmod a+rw -R 试试?
|
2
muyege OP @UnisandK 不管用,vagrant 共享目录默认是给了 vagrant 用户最大权限,除非我改成其他用户需要在配置文件里面改权限,当然我也那么做过,同样不行
|
3
CuminLo 2017-03-29 10:29:53 +08:00
PHP 是装在了共享盘上了吧?
|
4
gouchaoer 2017-03-29 10:44:23 +08:00
就是 root 启动的,只有 worker 自己 fork 出来会降到 nobody 或者 www-data 之类的
|
6
muyege OP @gouchaoer 我知道主进程是 root 启动的,现在我要把 worker 进程也改成 root 才能解析 php,就是 php-fpm 的配置文件里,user=root,group=root,才行
|
7
Havee 2017-03-29 10:56:46 +08:00
你这主题,看得好累,你 2 楼回复压根不知所云啊
问下 listen 到 socket 文件的吗? 看下这个 socket 文件权限 尝试指定 listen.owner listen.group 用户用户组 |
8
muyege OP @Havee listen 到 9000 端口,socket 文件也试了,socket 文件是 root 权限,listen.owner 和 listen.group 也设置了,没什么用,改成什么都无所谓,只有当 group 为 root 或者 user 和 group 都为 root 时,才正常
|
9
winterbells 2017-03-29 11:12:01 +08:00 1
看看 socket 文件权限,之前我就是这个问题
|
10
muyege OP @winterbells 还是不行,只有 root 权限才能运行,其他权限改了个遍,也不好使
|
11
Havee 2017-03-29 11:29:48 +08:00
给日志吧,不能运行的日志是什么
包括 php-fpm nginx 的日志 |
12
muyege OP @Havee
2017/03/29 03:57:21 [error] 4398#4398: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.1.1, server: www.yii.com, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.yii.com" 2017/03/29 03:57:22 [error] 4398#4398: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.1.1, server: www.yii.com, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.yii.com" 2017/03/29 03:57:22 [error] 4398#4398: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.1.1, server: www.yii.com, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.yii.com" 2017/03/29 03:57:22 [error] 4398#4398: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.1.1, server: www.yii.com, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.yii.com" 2017/03/29 03:57:23 [error] 4398#4398: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.1.1, server: www.yii.com, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.yii.com" 2017/03/29 03:57:23 [error] 4398#4398: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.1.1, server: www.yii.com, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.yii.com" 2017/03/29 03:57:23 [error] 4398#4398: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.1.1, server: www.yii.com, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.yii.com" 2017/03/29 03:57:23 [error] 4398#4398: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.1.1, server: www.yii.com, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.yii.com" 2017/03/29 03:57:23 [error] 4398#4398: *1 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 192.168.1.1, server: www.yii.com, request: "GET /index.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.yii.com" |
14
Havee 2017-03-29 13:26:33 +08:00 1
刚吃完饭,看了日志,第一反应是你网站目录的权限是 nobody 吗?
然后才发现你提问中有这句话 “目录所有者是 vagrant ”... 目录所有者权限改一下,如果是虚拟机+共享盘模式,以虚拟机中 nobody 的 uid guid 为准 |
16
msg7086 2017-03-29 16:10:54 +08:00
nobody 读 vagrant 应该是读不到的吧……
|