0

我试图运行我的应用程序并检查 production.log 上的一些输出。但是Ruby on Rails会引发此错误。阿帕奇日志

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 以使其工作,但我意识到该文件处于 root 访问权限下。

所以我的文件权限是

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

我不确定如何允许 Ruby on Rails 访问此文件。我对管理 Linux 生产环境还很陌生,所以我请求您原谅我的无知。

4

2 回答 2

2

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

于 2010-03-18T10:45:45.940 回答
2

好吧,我刚刚想通了。

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

PassengerDefaultUser username

使用 chown 分配所有权:

chown -R username:username <folder>

我不知道这是否是正确的方法,但它对我有用。

于 2010-03-18T16:45:58.180 回答