Passenger problem: “no such file to load” — /config/environment

你说的曾经没有我的故事 提交于 2019-12-04 07:10:21

Naturally, it just took me posting the question to stumble onto the answer. In order to provide info for anyone else searching on this problem, I'll post some details here.

The relevant lines from the nginx.conf:

user www-data; # in order to have nginx not run as root

passenger_default_user www-data; # likewise for passenger

root /opt/foo/app/current/public;

The key at this point is to make sure that the application files are owned by www-data, in particular config/environment.rb because apparently Passenger looks at its owner to determine who to run as. This might mean that the passenger_default_user entry is irrelevant? But it's good to have it there as documentation of intent anyway, perhaps.

Finally, make sure that the parent directories of your app are all reachable by www-data -- in my case the system default setup had left a directory 0700, which I'd missed.

Modern Passenger prefers Rack to Rails. If you have a config.ru in your Rails application, Passenger will try to load it as a Rack application. This may be causing problems. In particular, your error message refers to config/environment -- note the lack of the .rb extension typical in a Rails application.

Try moving config.ru out of the way if it exists.

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