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