簡體   English   中英

Rails Nginx不會加載字體

[英]Rails Nginx wont load fonts

我已經預編譯了我的資產,除了ttf文件的字體外,所有資源都在加載中。 該資產還具有ttf.gz文件。 我已經檢查了名稱,並確保其名稱相同。 我的靜態圖像也加載得很好。

我的nginx配置看起來像這樣

server {
     listen 80;

     root /home/usr/apps/web/public;

     location / {
            proxy_pass http://app;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_redirect off;
    }

    location ~* ^/assets/ {
            gzip_static on;
            expires 1y;
            add_header Cache-Control public;

            location ~* \.(eot|otf|ttf|woff|woff2)$ {
                    add_header Access-Control-Allow-Origin *;
            }

    }

     error_page 500 502 503 504 /500.html;
     client_max_body_size 4G;
     keepalive_timeout 10;

}

控制台顯示的內容

Failed to load resource: the server responded with a status of 404 (Not Found)

我剛剛修好了。 看起來問題出在預編譯上。 我的字體薩斯未正確配置以獲取我的字體。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM