Add this to .htaccess on the root directory of your domain. You may add other file extenstions as per your need.

For Apache Server


<FilesMatch ".(eot|otf|ttf|woff|woff2|css|jpg|jpeg)">
    Header always set Access-Control-Allow-Origin "*"
</FilesMatch>

For nginx Servers

Add this to your vhosts file within server {} directive and restart nginx. You may add other file extensions too as per your needs.


location ~* \.(eot|otf|ttf|woff|woff2|css|jpg|jpeg)$ {
    add_header Access-Control-Allow-Origin *;
}

You may as well check your nginx file if it contains any errors using following command


rafled@Ubuntu:~$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Then, restart nginx


rafled@Ubuntu:~$ sudo systemctl restart nginx