Like the title.thanks.
#1 楼 @Rei so the /opt/nginx/conf/nginx.conf must setting like this ??
server {
    listen       80;
    server_name  you.host.name; # 请替换成你网站的域名
    rails_env    production;
    root         /home/jason/www/gitlab/public;
    passenger_enabled on;
    location ~ ^(/assets) {   #The important
      access_log        off;
      expires           max; 
    }
  }
but my zurb-foundation template can't work correct.
if i don't add this:
location ~ ^(/assets) {   #The important
      access_log        off;
      expires           max; 
    }
my zurb-foundation template can't work correct.
ActionController::RoutingError (No route matches [GET] "/assets/foundation-wysihtml5/index.css"):
I, [2014-04-19T16:23:24.666455 #3727]  INFO -- : Started GET "/assets/foundation-icons.ttf" for 50.117.115.237 at 2014-04-19 16:23:24 +0800
F, [2014-04-19T16:23:24.667543 #3727] FATAL -- : 
ActionController::RoutingError (No route matches [GET] "/assets/foundation-icons.ttf"):
  actionpack (4.0.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in call'
  actionpack (4.0.3) lib/action_dispatch/middleware/show_exceptions.rb:30:incall'
  railties (4.0.3) lib/rails/rack/logger.rb:38:in call_app'
  railties (4.0.3) lib/rails/rack/logger.rb:20:inblock in call'
  activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in block in tagged'
  activesupport (4.0.3) lib/active_support/tagged_logging.rb:25:intagged'
  activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in tagged'
  railties (4.0.3) lib/rails/rack/logger.rb:20:incall'
  actionpack (4.0.3) lib/action_dispatch/middleware/request_id.rb:21:in call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:incall'
  rack (1.5.2) lib/rack/runtime.rb:17:in call'
  activesupport (4.0.3) lib/active_support/cache/strategy/local_cache.rb:83:incall'
  rack (1.5.2) lib/rack/sendfile.rb:112:in call'
  railties (4.0.3) lib/rails/engine.rb:511:incall'
  railties (4.0.3) lib/rails/application.rb:97:in call'
  passenger (4.0.41) lib/phusion_passenger/rack/thread_handler_extension.rb:74:inprocess_request'
  passenger (4.0.41) lib/phusion_passenger/request_handler/thread_handler.rb:141:in accept_and_process_next_request'
  passenger (4.0.41) lib/phusion_passenger/request_handler/thread_handler.rb:109:inmain_loop'
I, [2014-04-20T12:37:47.916557 #4993]  INFO -- : Started GET "/" for 127.0.0.1 at 2014-04-20 12:37:47 +0800
I, [2014-04-20T12:37:48.166054 #4993]  INFO -- : Processing by StaticPagesController#home as HTML
I, [2014-04-20T12:37:48.310119 #4993]  INFO -- :   Rendered static_pages/home.html.haml within layouts/application (11.9ms)
I, [2014-04-20T12:37:48.370456 #4993]  INFO -- :   Rendered layouts/_seo.html.haml (15.6ms)
I, [2014-04-20T12:37:48.384051 #4993]  INFO -- :   Rendered layouts/_shim.html.haml (3.9ms)
I, [2014-04-20T12:37:48.387417 #4993]  INFO -- :   Rendered layouts/_head.html.haml (59.3ms)
I, [2014-04-20T12:37:48.613887 #4993]  INFO -- :   Rendered layouts/_navbar.html.haml (218.1ms)
I, [2014-04-20T12:37:48.823821 #4993]  INFO -- :   Rendered layouts/_footer.html.haml (204.2ms)
I, [2014-04-20T12:37:48.825427 #4993]  INFO -- : Completed 200 OK in 655ms (Views: 491.5ms | ActiveRecord: 41.9ms)
I, [2014-04-20T12:37:49.000870 #4993]  INFO -- : Started GET "/default/logo.png" for 127.0.0.1 at 2014-04-20 12:37:49 +0800
F, [2014-04-20T12:37:49.005858 #4993] FATAL -- : 
ActionController::RoutingError (No route matches [GET] "/default/logo.png"):
  actionpack (4.0.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (4.0.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.0.3) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.0.3) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `block in tagged'
  activesupport (4.0.3) lib/active_support/tagged_logging.rb:25:in `tagged'
  activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `tagged'
  railties (4.0.3) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.0.3) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.0.3) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
  actionpack (4.0.3) lib/action_dispatch/middleware/static.rb:64:in `call'
  rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
  railties (4.0.3) lib/rails/engine.rb:511:in `call'
  railties (4.0.3) lib/rails/application.rb:97:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  rack (1.5.2) lib/rack/content_length.rb:14:in `call'
  rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
  /home/kevin/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
  /home/kevin/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
  /home/kevin/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
I, [2014-04-20T12:37:49.807919 #4993]  INFO -- : Started GET "/default/logo.png" for 127.0.0.1 at 2014-04-20 12:37:49 +0800
F, [2014-04-20T12:37:49.812687 #4993] FATAL -- : 
ActionController::RoutingError (No route matches [GET] "/default/logo.png"):
  actionpack (4.0.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (4.0.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.0.3) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.0.3) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `block in tagged'
  activesupport (4.0.3) lib/active_support/tagged_logging.rb:25:in `tagged'
  activesupport (4.0.3) lib/active_support/tagged_logging.rb:67:in `tagged'
  railties (4.0.3) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.0.3) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.0.3) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
  actionpack (4.0.3) lib/action_dispatch/middleware/static.rb:64:in `call'
  rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
  railties (4.0.3) lib/rails/engine.rb:511:in `call'
  railties (4.0.3) lib/rails/application.rb:97:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  rack (1.5.2) lib/rack/content_length.rb:14:in `call'
  rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
  /home/kevin/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
  /home/kevin/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
  /home/kevin/.rbenv/versions/2.0.0-p451/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
          日志显示 public 目录下没有 /default/logo.png 这个文件。我想不至于导致样式不正常吧。
其实到现在我都不知道楼主想做什么,发生了什么错误。
application-b90139c1a32eb4597ba8d4f8c801ba37.css 的前面一部分代码是:
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 */
meta.foundation-version {
  font-family: "/5.1.0/"; }
meta.foundation-mq-small {
  font-family: "/only screen and (max-width: 40em)/";
  width: 0em; }
meta.foundation-mq-medium {
  font-family: "/only screen and (min-width:40.063em)/";
  width: 40.063em; }
meta.foundation-mq-large {
  font-family: "/only screen and (min-width:64.063em)/";
  width: 64.063em; }
meta.foundation-mq-xlarge {
  font-family: "/only screen and (min-width:90.063em)/";
  width: 90.063em; }
meta.foundation-mq-xxlarge {
  font-family: "/only screen and (min-width:120.063em)/";
  width: 120.063em; }
meta.foundation-data-attribute-namespace {
  font-family: false; }
html, body {
  height: 100%; }
*,
*:before,
*:after {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box; }
html,
body {
  font-size: 100%; }
body {
  background: white;
  color: #222222;
  padding: 0;
  margin: 0;
  font-family: "Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  position: relative;
  cursor: default; }
a:hover {
  cursor: pointer; }
img,
object,
embed {
  max-width: 100%;
  height: auto; }
          现在你需要确定的是:production 环境下,确定 zurb foundation 相关的 css 有没有打包到最终的 application-......css 中。如果application-......css不包含 zurb foundation 相关的 css 代码,那么就是引入的问题;如果包含了相关的代码,那么还要进一步确定导致你页面异常的那部分代码是什么,再进一步查看问题,一点一点细化吧。
又出现这个问题了
movie git:(master) ✗ RAILS_ENV=production bundle exec rake assets:precompile --trace ** Invoke assets:precompile (first_time) ** Invoke assets:environment (first_time) ** Execute assets:environment ** Invoke environment (first_time) ** Execute environment ** Execute assets:precompile rake aborted! Unexpected character '#' (line: 25970, col: 0, pos: 815789)
Error at new JS_Parse_Error (/tmp/execjs20140420-13049-1d1u7ss.js:2357:10748) at js_error (/tmp/execjs20140420-13049-1d1u7ss.js:2357:10967) at parse_error (/tmp/execjs20140420-13049-1d1u7ss.js:2357:12685) at Object.next_token as input at next (/tmp/execjs20140420-13049-1d1u7ss.js:2357:19006) at semicolon (/tmp/execjs20140420-13049-1d1u7ss.js:2357:19851) at simple_statement (/tmp/execjs20140420-13049-1d1u7ss.js:2357:22663) at /tmp/execjs20140420-13049-1d1u7ss.js:2357:20814 at /tmp/execjs20140420-13049-1d1u7ss.js:2357:20063 at /tmp/execjs20140420-13049-1d1u7ss.js:2358:40 at Object.parse (/tmp/execjs20140420-13049-1d1u7ss.js:2358:249)