Webfonts woff ttf 404 on nginx

Error: Getting 404 for woff woff2 and ttf files on nginx server on Ubuntu

Solution:

Go to your config file for your site: /etc/nginx/sites-available/yoursite.com

Add the follwong section in that file:


    # Web fonts
    location ~* \.(?:woff2|woff|eot|otf|ttf)$ {
      expires 100d;
      access_log off;
      add_header Cache-Control "public";
    }

Restart the nginx service following How to restart nginx service on Ubuntu