Can't access log files in production

女生的网名这么多〃 提交于 2019-12-01 13:07:28

问题


I was trying to run my application and check for some output on the production.log. However Ruby on Rails throws this error. Apache log

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.

I have performed the necessary chmod 666 production.log to make it work but I realized that the file is under root access.

So my file permissions are

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

I'm not sure how to allow Ruby on Rails to access this file. I'm fairly new to managing a Linux production environment so I request you to excuse my ignorance.


回答1:


I think you need to change the user and group of production.log to whatever user and group Rails (i.e. Passenger or Mongrel or whatever you are using) runs under.




回答2:


Okay I just figured it out.

First need to update Apache.conf passenger configurations:

PassengerDefaultUser username

The assign ownership using chown:

chown -R username:username <folder>

I don't know if this is the right way but it worked for me.



来源:https://stackoverflow.com/questions/2469059/cant-access-log-files-in-production

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