无法访问生产中的日志文件

我试图运行我的应用程序,并检查production.log上的一些输出。 但是Ruby on Rails会抛出这个错误。 Apache日志

Rails Error: Unable to access log file. Please ensure that /var/www/somefolder/someapp/log/production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.

我已经执行了必要的chmod 666 production.log,使其工作,但我意识到,该文件是在根访问。

所以我的文件权限

-rw-rw-rw- 1 root root 20845 2010-03-18 01:18 production.log

我不知道如何让Ruby on Rails来访问这个文件。 我对pipe理Linux生产环境相当陌生,因此请求您原谅我的无知。

我认为你需要将用户和production.log组更改为任何用户和组Rails(即Passenger或Mongrel或任何你正在使用的)。

好吧,我只是想出来了。

首先需要更新Apache.conf的乘客配置:

PassengerDefaultUser username

使用chown分配所有权:

chown -R username:username <folder>

我不知道这是否正确,但对我有用。