Nginx worker process cant access config.ru

二次信任 提交于 2019-12-02 12:41:54

问题


I have set up my RoR app on DO Ubuntu x64. On Nginx port 8080.

My config:

server {
  listen 8080;
 # server_name www.mydomain.com;
  passenger_enabled on;
  passenger_app_env development;
  root /home/edgars/Proj/public;
}

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.

As my research from this question shows I need to ensure that Nginx user can access that path.

sudo -u www-data cd /edgars

got error :sudo: cd: command not found

sudo gpasswd -a www-data edgars

got : Adding user www-data to group edgars

But still I cant fix that error.

Any other workaround ?

Thanks in advance.


回答1:


Please check the $PATH for your the user www-data. The fact that the command cd was not found, is troubling.

Also please run this command

sudo -u www-data stat /home/edgars/Proj/config.ru

ensure that your www-data user can stat the above file. This will help you understand if you set the file permissions correctly.

Also, have you enabled SElinux on your Ubuntu? If yes, please follow the instructions here.




回答2:


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;

and it's done. Good Luck!

References: Click here



来源:https://stackoverflow.com/questions/28202371/nginx-worker-process-cant-access-config-ru

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!