我在生产中使用rails + nginx + unicorn时出错
ActionView :: Template :: Error(application.css未预编译):
我正在尝试使用sqlite3部署clean rails app。 当我访问http://cayennepower.ru/posts时我很抱歉,但出现了错误。 在首页上,静态欢迎页面运行良好。 在我的app / log production.log中,我有这样的错误
Started GET "/posts" for 127.0.0.1 at 2012-12-12 06:47:48 +0100
Processing by PostsController#index as */*
Rendered posts/index.html.erb within layouts/application (0.4ms)
Completed 500 Internal Server Error in 3ms
ActionView::Template::Error (application.css isn't precompiled):
2: <html>
3: <head>
4: <title>CleanRails</title>
5: <%= stylesheet_link_tag "application", :media => "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___741543018_80365330'
app/controllers/posts_controller.rb:7:in `index'
在config / enviroments / production.rb中我放置了
config.assets.compile = true
config.assets.precompile += %w( application.css )
我运行了rake资产:precompile --trace RAILS_ENV = production
跟踪日志
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/usr/local/rvm/rubies/ruby-1.9.3-p327/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p327/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
** Invoke assets:precompile:nondigest (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:nondigest
但我仍有此错误
我的nginx.conf是
upstream cayennepower.ru {
server unix:/home/sites/cayennepower.ru/www/tmp/sockets/unicorn.sock;
# server 127.0.0.1:3000 fail_timeout=0;
}
我的domain.conf文件是
server {
listen 80;
server_name cayennepower.ru;
root /home/sites/cayennepower.ru/www/public;
try_files $uri/index.html $uri @unicorn;
location @unicorn {
#if (!-f $request_filename) {
proxy_pass http://cayennepower.ru;
break;
#}
}
}
非常感谢您的帮助!