我第一次设置了Ruby on Rails;在我的服务器上,我创建并加载了默认的rails应用程序。我可以查看默认页面(“欢迎加入!您正在使用Rails”),但是当我点击链接到“查看应用程序环境”时,它会生成500错误。Ruby on Rails安装:无法访问日志文件
(您可以查看here。)
我想知道更多有关该错误,但是,日志文件(“登录/ production.log”)是空的。看看我的Apache日志我发现:
Rails Error: Unable to access log file. Please ensure that /var/www/rails/myapp/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.
所以,我真的想让我的Ruby on Rails错误日志工作。
我知道这个问题之前已经发布过几次,但我什么都试过了我能找到的,所以这是我曾尝试:
- 创建了“登录/ production.log”文件,设置所有者到万维网数据,设置
chmod 0666
。 - 将“日志”文件夹的所有者设置为
www-data
,设置为chmod 0666
。 - 再次检查我的生产环境设置,以便设置
config.log_level = :info
。 经过Apache是否使用WWW的数据用户( “等/ apache2的/ envvars中”):
export APACHE_RUN_USER=www-data export APACHE_RUN_GROUP=www-data
“等/ apache2的/ MODS的可用/ passenger.conf” 具有默认的用户组乘客:
<IfModule mod_passenger.c> PassengerRoot /usr PassengerRuby /usr/bin/ruby PassengerDefaultUser www-data </IfModule>
“config.ru” 和 “CONFIGS/environment.rb文件” 的所有者为
www-data
我的虚拟主机已设置艾科rdingly:
DocumentRoot /var/www/rails/myapp/public RackBaseURI/ RackEnv production PassengerMaxPoolSize 4
已经阅读并试图在这些地方提出的所有修复:
- Rails: Unable to access log file
- Can't access log files in production
- http://railsforum.com/viewtopic.php?id=36168
- Why am I getting Permission denied error in deployment on files generated by capistrano?
- http://bradhe.wordpress.com/2011/06/26/a-sneaky-rails-3-bug-in-logging/
(这是我所记得的努力现在...)
我的一些环境设置:
- 的Ubuntu 11.10在Amazon EC2上运行
- 的Apache 2.2.20
- RVM 1.10.2
- Ruby 1.9。3P0
- 的Rails 3.1.3