简体   繁体   English

Rails错误:无法访问日志文件并且ActionView :: Template :: Error权限被拒绝

[英]Rails Error: Unable to access log file And ActionView::Template::Error Permission denied

I'm deploy my app with capistrano on centos (apache + passenger), when access my web I got `HTTP 500 (Internal Server Error)' and check error_log file , here's error look likes : 我在centos(apache + passenger)上使用capistrano部署了我的应用程序,当访问我的网站时,我收到了“ HTTP 500(内部服务器错误)”并检查error_log文件,这里的错误看起来像:

DAV/2 Phusion_Passenger/3.0.19 mod_ssl/2.2.24 OpenSSL/1.0.0-fips configured -- resuming normal operations
Rails Error: Unable to access log file. Please ensure that /home/admin/myaap/releases/20130506191509/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..

production.log permission production.log权限

-rwxrwxr-x 1 root root 46211 May 6 20:49 production.log

and

ActionView::Template::Error (Permission denied - /home/admin/myaap/releases/20130506191509/tmp/cache/assets/D3B

directory D3B not found. 找不到目录D3B。

I am looking for a solution via google, one of which is sudo chown -R root:root /home/admin/myapp/ but not working for me, Is there any other way to fix it? 我正在通过google寻找解决方案,其中之一是sudo chown -R root:root /home/admin/myapp/但对我不起作用,还有其他解决方法吗?

Note : 注意 :

I'm using user root for deploy and installing rvm, and directory root location on user 'admin' (kloxo control panel) 我正在使用root用户来部署和安装rvm,并在用户'admin'上使用目录根目录(kloxo控制面板)

UPDATE UPDATE

On error_log file not found error about permission and unable to access, I'm using chmod go-w /home/admin/myapp and chmod 0666 production.log , but my web still 500 server error, How do I check error? 在error_log文件上未找到有关权限且无法访问的错误,我正在使用chmod go-w /home/admin/myappchmod 0666 production.log ,但是我的网站仍然是500服务器错误,如何检查错误?

As Rails is suggesting in the error log, you should change permissions for the log file to 066: 正如Rails在错误日志中建议的那样,您应该将日志文件的权限更改为066:

chmod 0666 production.log

You are using root to deploy, but the web server is using another user name. 您正在使用root进行部署,但是Web服务器正在使用另一个用户名。

您需要使apache用户成为您应用的所有者,例如:

sudo chown -R apacheuser:apacheuser /home/admin/myapp/

I've always had success with the the log file permissions as 644. When this has happened to me, more than once I might add, it has always been answered by the question linked below. 我一直以644作为日志文件权限而获得成功。当我遇到这种情况时,我可能不止一次添加,始终可以通过以下链接的问题来回答。 Since this is the first answer in Google for the query I use, I'm linking to the answer that I really want. 由于这是Google针对我使用的查询的第一个答案,因此我链接到了我真正想要的答案。

Rails: Unable to access log file Rails:无法访问日志文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM