整合营销服务商

电脑端+手机端+微信端=数据同步管理

免费咨询热线:

网站icon字体图标不显示解决方案

网站icon字体图标不显示解决方案

iYunCMS(帝云CMS)-免费开源可商用的PHP万能建站程序

帝云CMS建站过程中有时会发现网站后台或者前端出现图标无法显示的问题,图标显示为方框状态了,如下图所示:

审查元素可以看到如下的报错信息

原因分析

这是因为跨域访问造成的,也就是访问的域名并不是网站填写的主域名。

网站设置中填写的是域名A,但使用域名B访问,就会存在跨域问题。

解决办法:

一、apache环境

方法1:

直接在网站根目录 .htaccess文件 中添加如下代码即可:

<IfModule mod_headers.c>
# Make sure proxies don’t deliver the wrong contentHeader append Vary User-Agent env=!dont-vary
  <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css)$">
    Header set Access-Control-Allow-Origin "*"
  </FilesMatch>
</IfModule>

方法2:

在httpd.conf 尾部加上

LoadModule headers_module modules/mod_headers.so
<IfModule mod_headers.c>
# Make sure proxies don’t deliver the wrong contentHeader append Vary User-Agent env=!dont-vary
  <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css)$">
    Header set Access-Control-Allow-Origin "*"
  </FilesMatch>
</IfModule>

二、Nginx环境

在nginx.conf 内部加上

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

如果是宝塔面版,在网站配置文件中添加即可,如下图所示:

三、注意事项

1、如果用了CDN的话,需要配置HTTP头

entOS 中部署JasperReport时出错:

net.sf.jasperreports.engine.util.JRFontNotFoundException: Font '宋体' is not available to the JVM. See the Javadoc for more details.

原因:操作系统默认语言是英文版的。修改为中文并拷贝windows的字体到linux系统中并应用,重启应用服务器即可。

解决方法:

1、把需要用到的字体(可以直接拷贝windows系统的C:\WINDOWS\Fonts 下的相关字体)拷贝当前项目的classpath下,一般为classes目录下

2、在classpath里添加 jasperreports.properties 属性文件

文件内容为:net.sf.jasperreports.awt.ignore.missing.font=true

3、重启应用服务器

如若转载,请注明出处:开源字节 https://sourcebyte.vip/article/303.html

作者 | 张旭乾