我使用 Azure 库中的 Wordpress 安装在 Azure 中作为 Azure 网站运行了一个测试 Wordpress 站点。
该网站正常运行,并且似乎按预期运行。但有一个异常(exception)。我正在使用自定义网络字体 - http://fortawesome.github.io/Font-Awesome/ .
该字体有 OTF、SVG、TTF、EOT 和 WOFF 版本。据我了解,不同的设备/浏览器使用不同版本的文件来渲染字体。
我在提供 .woff 版本的文件时遇到问题。
我已在 Azure 门户中打开日志记录,并且可以看到以下错误
SECURITY_DENIED_BY_MIMEMAP
FileName C:\DWASFILES\SITES\WWW-MYWPTESTSITE\VIRTUALDIRECTORY0\SITE\WWWROOT\WP-CONTENT\THEMES\AVADA\AVADA\FONTS\FONTAWESOME-WEBFONT.WOFF
我通过 SFTP 登录并浏览到该文件夹,确认服务器上存在 .woff 文件。
我在网上看到过有关将此信息添加到 web.config 文件的其他帖子。像这样的东西:
<?xml version="1.0"?>
<!-- Web.Config Configuration File -->
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<staticContent>
<remove fileExtension=".svg" />
<remove fileExtension=".eot" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".woff" mimeType="application/x-woff" />
</staticContent>
</system.webServer>
</configuration>
但是,我不确定如何或应该将其添加到 Azure 托管站点。
更新:将上述代码保存为 web.config 并上传到 wwwroot 文件夹。 Azure 现在将允许在请求时下载 .woff 字体。
最佳答案
将以下内容保存为 web.config。将 web.config 文件上传到 Azure 中托管的站点的 wwwroot 文件夹。现在将提供 .woff 文件。
<?xml version="1.0"?>
<!-- Web.Config Configuration File -->
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<staticContent>
<remove fileExtension=".svg" />
<remove fileExtension=".eot" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".woff" mimeType="application/x-woff" />
</staticContent>
</system.webServer>
</configuration>
关于azure - 从 Azure 提供 WOFF 字体时出现 SECURITY_DENIED_BY_MIMEMAP 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15883149/