Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I was wondering if someone could tell me what the nginx rule for the following htaccess code would be. I've searched online but I haven't found anything.

<FilesMatch "\.(ttf|otf|eot)$">
    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "*"
share|improve this question

1 Answer 1

It would look something like this:

server {
    listen        80;
    server_name   nginx.org  www.nginx.org;
    root          /data/www;

    location / {
        index     index.html  index.php;

    location ~* \.(ttf|otf|eot)$ {
        add_header Access-Control-Allow-Origin "*";

I'm just writing this from memory, so you'll have to test it. The location ~* means a regex case insensitive match. All other confs in server are informative. Just so you grok how these work together.

More info:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.