发布于 2016-02-05 06:04:18 | 301 次阅读 | 评论: 1 | 来源: 网友投递

这里有新鲜出炉的精品教程,程序狗速度看过来!

Apache Web服务器

Apache是世界使用排名第一的Web服务器软件。它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件。


这篇文章主要介绍了Apache、Nginx下Font Awesome在 Firefox 中不显示问题解决方法,在配置中增加一个响应头即可解决这个问题,需要的朋友可以参考下

一、Nginx服务器解决方法

服务器使用的是 Nginx,要在响应的头部添加 Access-Control-Allow-Origin 字段,添加方法是用 add_header 指令:

配置例子:



location /assets/ {

    gzip_static on;

    expires max;

    add_header Cache-Control public;

    add_header Access-Control-Allow-Origin *;

}

二、Apache服务器解决方法

Font Awesome (firefox无法显示 火狐无法显示)Cross domain (跨域问题) 

The problem

It seems that, for security reasons, Firefox simply don't allow you to use by default a font that is not hosted on your domain, not even on your subdomain. The CDN based websites can be also affected in this case.

The solution

After some investigations, I found out the workaround: set a Access-Control-Allow-Origin header to the font.



<FilesMatch "\.(ttf|otf|eot|woff)$">

  <IfModule mod_headers.c>

    Header set Access-Control-Allow-Origin "*"

  </IfModule>

</FilesMatch>


Also, if you are using nginx as your webserver you will need to include the code below in your virtual host file:


location ~* \.(eot|otf|ttf|woff)$ {

    add_header Access-Control-Allow-Origin *;

}



最新网友评论  共有(1)条评论 发布评论 返回顶部
hkljq 发布于2016-02-15 02:48:58
thx
支持(0)  反对(0)  回复

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务