The original post: /r/nginx by /u/yukiiiiii2008 on 2024-07-25 17:41:17.

After adding a location block to serve fonts, it suddenly gives me this error.

default.conf

server {
    listen       9003;
    server_name  localhost;

    # I add this location block to default, it suddenly stop to work and give me the error
    location ~* \.(eot|ttf|woff|woff2|svg)$ {
        add_header Access-Control-Allow-Origin *;
    }

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}