Exec format error: exec of .woff’ failed in Apache
[error] [client 0.0.0.0] (8)Exec format error:
exec of '
/opt/cloudhost/apache/fonts/libre-barcode-39-extended-v7-latin-regular.woff' failed
[error] [client 0.0.0.0] Premature end of script headers:
libre-barcode-39-extended-v7-latin-regular.woff
For display fonts in website, browser must receive font files with correct http headers.If the server does not set the required fonts path in headers
browser can report errors in console or it will fail to display fonts.
Your server is already configured, and you don’t need to change anything. If not, you need to check about mime-type headers.
Apache
Go to /etc/httpd/conf/httpd.conf or open httpd.conf
To set right mime-types for font files, add this lines to config:
AddType application/x-font-ttf ttc ttf
AddType application/x-font-otf otf
AddType application/font-woff woff
AddType application/font-woff2 woff2
AddType application/vnd.ms-fontobject eot
If you can’t edit config, create .htaccess file in folder with your project and add lines there.
For CORS headers add:
<FilesMatch ".(eot|ttf|otf|woff|woff2)">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
nginx
By default nginx has no default mime types for fonts, and wrong mime type for .eot files. Go to folder with configs and find where mime types are defined. Usually, that’s in the mime.types file.Search .eot and string with it.Add strings below.
application/x-font-ttf ttc ttf;
application/x-font-otf otf;
application/font-woff woff;
application/font-woff2 woff2;
application/vnd.ms-fontobject eot;
For CORS headers, add something like this to your vhost config
location ~* \.(eot|otf|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
}