Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

It would look something like this:

server {
    listen        80;
    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.