Apache、Nginx下Font Awesome在 Firefox 中不顯示問(wèn)題解決方法
一、Nginx服務(wù)器解決方法
服務(wù)器使用的是 Nginx,要在響應(yīng)的頭部添加 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服務(wù)器解決方法
Font Awesome (firefox無(wú)法顯示 火狐無(wú)法顯示)Cross domain (跨域問(wèn)題)
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 *;
}
相關(guān)文章
apache 二級(jí)域名解析實(shí)現(xiàn)方法
首先,你的擁有一個(gè)有泛域名解析的頂級(jí)域名,例如: domain.com其次,在 httpd.conf 中打開 mod_rewrite之后,在 httpd.conf 的最后,添加以下內(nèi)容2009-11-11修改ubuntu 18.04的sources.list源為阿里或清華鏡像的方法
這篇文章主要介紹了修改ubuntu 18.04的sources.list源為阿里或清華鏡像的方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-08-08Ubuntu下安裝nvidia顯卡驅(qū)動(dòng)(安裝方式簡(jiǎn)單)
這篇文章主要介紹了Ubuntu下安裝nvidia顯卡驅(qū)動(dòng),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-05-05Apache httpd 安裝module mod_expires、mod_deflate的方法
Apache httpd 安裝module mod_expires、mod_deflate的方法,需要的朋友可以參考下。2011-11-11CentOS利用screen實(shí)現(xiàn)多任務(wù)管理功能
screen是一個(gè)功能強(qiáng)大的終端復(fù)用工具,它可以創(chuàng)建多個(gè)虛擬終端窗口,并且可以在這些窗口之間自由切換,本文將從安裝screen開始,詳細(xì)介紹其常用命令及使用示例,幫助讀者更好地理解和掌握這個(gè)實(shí)用工具2023-06-06Centos7實(shí)現(xiàn)MySQL基于日志還原數(shù)據(jù)的示例代碼
這篇文章主要介紹了Centos7實(shí)現(xiàn)MySQL基于日志還原數(shù)據(jù)的示例代碼,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-07-07Linux 下讀XML 的類詳解及實(shí)現(xiàn)代碼
這篇文章主要介紹了 Linux 下讀XML 的類詳解及實(shí)現(xiàn)代碼的相關(guān)資料,需要的朋友可以參考下2017-03-03