Deploy FontAwesome to your own server/CDN for full control over speed and availability
Most flexible approach, suitable for projects with build processes:
npm install and copy files to your static directory
# ├── webfonts/
# │ ├── fa-solid-900.woff2
# │ ├── fa-regular-400.woff2
# │ ├── fa-brands-400.woff2Most recommended method for projects with build processes
No npm/pnpm needed, directly download the official ZIP package:
Download the official release ZIP package
wget https://github.com/FortAwesome/Font-Awesome/archive/refs/tags/6.7.2.zip
unzip 6.7.2.zip
# Files located at node_modules/@fortawesome/fontawesome-free/
# Copy css/, webfonts/, and js/ directories to your static resource directory.
cp -r Font-Awesome-6.7.2/css /your-project/static/fa/
cp -r Font-Awesome-6.7.2/webfonts /your-project/static/fa/Best for Chinese users - upload to object storage with CDN:
Upload to Alibaba/Tencent Cloud OSSRecommended configuration:
Nginx configuration is critical for self-hosting performance:
# /etc/nginx/sites-available/fontawesome
server {
listen 443 ssl;
server_name fa.yourdomain.com;
root /var/www/fontawesome;
index index.html;
# Font files: 1 year cache + immutable
location ~* \.(woff2?|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
add_header Access-Control-Allow-Origin "*";
}
# CSS/JS: 1 year cache
location ~* \.(css|js)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# SVG: 1 week cache
location ~* \.svg$ {
expires 1w;
add_header Cache-Control "public";
}
# Enable Brotli compression (brotli module required)
brotli on;
brotli_types font/woff2 font/ttf text/css application/javascript;
}| Dimension | Public CDN (cdnjs/jsDelivr) | Self-hosted |
|---|---|---|
| Difficulty | Minimal (one line) | Server configuration required |
| China Speed | Moderate (depends on CDN nodes) | Controllable (OSS + CDN) |
| Reliability | Third-party SLA | Fully controllable |
| Caching | Uncontrollable | Fully Customizable |
| Version Management | Auto latest | Manual update |
| Cost | Free | OSS storage + CDN traffic (usually very low) |
| HTTPS | HTTPS | SSL cert needed |
Use symlink for version management
ln -s /var/www/fontawesome/6.7.2 /var/www/fontawesome/latest
Use symlink for version management (avoid modifying HTML references)
HTML always references /fa/latest/css/all.min.css, upgrade by updating symlink