Ajouter 'FontAndCSSServer.md'

This commit is contained in:
Romain de Laage 2020-05-09 09:30:20 +02:00
parent 8064504b00
commit 48a949adc5
1 changed files with 28 additions and 0 deletions

28
FontAndCSSServer.md Normal file
View File

@ -0,0 +1,28 @@
Nous allons mettre en place un server de polices et css. Pour Apache on ajoute un simple serveur comme pour un site statique puis on ajoute dans la racine le fichier .htaccess suivant :
```
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-opentype .otf
AddType image/svg+xml .svg
AddType application/x-font-ttf .ttf
AddType application/font-woff .woff
AddType application/font-woff2 .woff2
<FilesMatch "\.(ttf|otf|eot|woff|woff2)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
```
Pour nginx on fait un site statique auquel on ajoute la directive suivante:
```
location ~* \.(eot|otf|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
}
```
il faut en plus ajouter ceci dans le fichier mime.types de la configuration nginx
```
font/ttf ttf;
font/otf otf;
font/woff woff;
font/woff2 woff2;
application/vnd.ms-fontobject eot;
```