首页 > 技术文章 > nginx 下使用 bootstrap 字体的问题

tumio 2016-04-15 16:05 原文

使用boostrap时,出现

glyphicons-halflings-regular.ttf

glyphicons-halflings-regular.woff

glyphicons-halflings-regular.woff2   404 (Not Found)

一开始以为我真是文件路径错误,但是css文件都加载出来了,表示没问题。那是什么问题呢

出在了nginx上,服务器做了文件类型限制

将ttf.woff woff2类型加上就好了

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

推荐阅读