2

www.* アセットのアクセス/エラー ログには何もありません。

upstream unicorn {
        server 127.0.0.1:5000;
}

server {
        listen 80;
        server_name mydomain.com www.mydomain.com xn--n3h.net;

        location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_redirect off;
                proxy_max_temp_file_size 0;

                # If you don't find the filename in the static files
                # Then request it from the unicorn server
                if (!-f $request_filename) {
                        proxy_pass http://unicorn;
                        break;
                }
        }
}

したがって、http: //mydomain.com にアクセスするとすべて正常に動作しますが、www.domain.com ブラウザーにアクセスすると、html ページが読み込まれるだけで、アセット (css、js など) は読み込まれません。なんてこと?何か不足していますか?HTML のアセットへのパスは、ドメインなしで絶対パスです (たとえば、"/assets/style.css" のみ)。

# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = true

# Compress JavaScripts and CSS
config.assets.compress = true

# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true

# Generate digests for assets URLs
config.assets.digest = true

ユニコーン使用。

4

0 に答える 0