1

Nginx と Unicorn を使用して Ruby on Rails アプリケーションをデプロイする際に問題が発生しました。

アプリケーションは正常に起動しましたが、アセットが読み込まれません。誰でも助けることができますか?

Gemfile

source 'https://rubygems.org'

gem 'rails', '4.0.0'
gem 'mysql2'

gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'therubyracer', platforms: :ruby
gem 'jquery-rails'
gem 'turbolinks'
gem 'hirb'
gem 'jbuilder', '~> 1.2'

gem "rmagick"
gem "carrierwave"
gem 'russian'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

gem 'unicorn'

Nginx 設定

server {
    listen 80;
    server_name domain-name.ru;
    return 301 $scheme://domain-name.ru$request_uri;
}

upstream unicorn {
    server unix:/tmp/unicorn.yp.sock fail_timeout=0;
}

server {

    listen 80;
    server_name yellowpump.ru;
    root path_to_app/domain-name.ru/www/public;

    charset utf-8;
    error_page 404 /404.html; 

    location / {
        try_files $uri/index.html $uri.html $uri @unicorn;
        error_page 404              /404.html;
        error_page 422              /422.html;
        error_page 500 502 503 504  /500.html;
        error_page 403              /403.html;
    }

    location @unicorn {
        proxy_pass http://unicorn;
    }

    location ~ ^/assets/ {
            root path_to_app/domain-name.ru/www/public;
            gzip_static on; # to serve pre-gzipped version
            expires 1y;
            add_header Cache-Control public;
            add_header ETag "";
            break;
    }

    #include conf/h5bp.conf;
}

ユニコーン会議

base_path = "path_to_root_directory_application"

working_directory base_path

pid "#{base_path}/tmp/pids/unicorn.pid"

stderr_path "#{base_path}/unicorn/unicorn.log"
stdout_path "#{base_path}/unicorn/unicorn.log"

listen "/tmp/unicorn.yp.sock"
worker_processes 4
timeout 30

ユニコーンはじめましたbundle exec unicorn -c config/unicorn.rb -d -E production

しようとしましrake assets:precompileたが、エラーが発生しましたmarshal data to short

誰が私に教えてもらえますか、私は何が間違っていますか??

4

0 に答える 0