网友回复
在 Nginx 下访问字体文件(如 .eot、.otf、.ttf、.woff、.svg 等)遇到 404 错误的问题,通常是因为 Nginx 配置文件中未正确配置这些文件类型的 MIME 类型或路径。下面是一些常见的解决方法:
1. 配置 MIME 类型确保 Nginx 配置文件中包含了这些文件类型的 MIME 类型定义。打开你的 Nginx 配置文件(通常是 /etc/nginx/nginx.conf 或 /etc/nginx/conf.d/default.conf),并在 http 块中添加以下内容:
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# other configurations ...
types {
application/vnd.ms-fontobject eot;
font/opentype otf;
application/x-font-ttf ttf;
font/woff woff;
font/woff2 woff2;
image/svg+xml ...点击查看剩余70%


