Nginx工作进程无法访问config.ru [英] Nginx worker process cant access config.ru
本文介绍了Nginx工作进程无法访问config.ru的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在DO Ubuntu x64上设置了RoR应用程序.在Nginx port 8080
.
I have set up my RoR app on DO Ubuntu x64. On Nginx port 8080
.
我的配置:
server {
listen 8080;
# server_name www.mydomain.com;
passenger_enabled on;
passenger_app_env development;
root /home/edgars/Proj/public;
}
在Nginx日志文件中出现错误:
In Nginx log file error:
Cannot stat '/home/edgars/Proj/config.ru; This error means that the Nginx worker process (PID 18065, running as UID 33) does not have permission to access this file.
根据我对此问题的研究,我需要确保Nginx用户可以访问该路径.
As my research from this question shows I need to ensure that Nginx user can access that path.
sudo -u www-data cd /edgars
得到错误:sudo: cd: command not found
sudo gpasswd -a www-data edgars
got:将用户www-data添加到edgars分组
got : Adding user www-data to group edgars
但是我仍然无法修复该错误.
But still I cant fix that error.
还有其他解决方法吗?
提前谢谢.
推荐答案
您需要放宽对Nginx worker进程可以访问应用程序目录的权限,方法是将目录设置为group-和world-executable:
You need to relax permissions to that the Nginx worker process can access your application directory, by making the directory group- and world-executable:
sudo chmod g+x,o+x /root/myapp/public;
sudo chmod g+x,o+x /root/myapp;
sudo chmod g+x,o+x /root;
就完成了.祝你好运!
参考文献: 查看全文