为什么乘客以用户 'nobody' 和组 'nogroup' 运行 Web 应用程序进程

Why the passenger runs the web application process as user 'nobody' and group 'nogroup'

出现错误:

Message from application: This web application process is being run as user 'nobody' and group 'nogroup' and must be able to access its application root directory '/root/dev/smartChat-service'. However, the parent directory '/root' has wrong permissions, thereby preventing this process from accessing its application root directory. Please fix the permissions of the directory '/root' first.

我认为根据here启用了用户沙盒。passenger_user_switching开启并且nginx进程具有root权限:

root      4296  0.0  0.2 140220  4316 ?        Ss   12:10   0:00 nginx: master process /usr/sbin/nginx
root      4297  0.0  0.3 140524  6508 ?        S    12:10   0:00 nginx: worker process
root      4298  0.0  0.3 140524  6508 ?        S    12:10   0:00 nginx: worker process
root      4299  0.0  0.3 140524  6508 ?        S    12:10   0:00 nginx: worker process
root      4300  0.0  0.3 140524  6508 ?        S    12:10   0:00 nginx: worker process

并且/root/smartChat-service目录和其中的directories/files归root所有:

rw-------  1 root root 3632 Sep  1 15:19 app.js
drw-------  2 root root 4096 Sep  1 15:19 bin
drw-------  3 root root 4096 Sep  3 08:56 config
-rw-------  1 root root  326 Sep  1 15:19 deploy_doc.sh
-rw-------  1 root root  419 Sep  1 15:19 gulpfile.js
drw-------  3 root root 4096 Sep  1 15:19 lib
drw-------  2 root root 4096 Sep  1 15:19 migrations
drw-------  2 root root 4096 Sep  1 15:19 models
drw------- 31 root root 4096 Sep  2 05:38 node_modules
-rw-------  1 root root 1015 Sep  1 15:19 package.json
drw-------  3 root root 4096 Sep  1 15:19 public
-rw-------  1 root root 1591 Sep  1 15:19 README.md
-rw-------  1 root root  168 Sep  1 15:19 redis_client.js
drw-------  3 root root 4096 Sep  1 15:19 routes
drw-------  6 root root 4096 Sep  1 15:19 test
-rw-------  1 root root  256 Sep  1 15:19 test.sh
drw-------  2 root root 4096 Sep  1 15:19 views

想知道为什么仍然出现该错误?

出于安全原因,Passenger 拒绝 运行 您的应用程序作为 root。如果您的 app.js 归 root 所有,Passenger 坚持将其 运行 改为 passenger_default_user(默认为 nobody)。您确实应该 chown 将您的文件发送给非 root 用户。